class RubyPager::Metadata

Attributes

creator[R]

Public Class Methods

blank_data() click to toggle source
# File lib/ruby_pager/metadata.rb, line 35
def self.blank_data
  res=Hash.new
  res["Creator"]="Ruby Page"
  res["Created"]=DateTime.now.strftime("%FT%T")
  res["LastChange"]=DateTime.now.strftime("%FT%T")
  return res
end
new(ex_data) click to toggle source
# File lib/ruby_pager/metadata.rb, line 5
def initialize(ex_data)
  @data=ex_data
  @creator = @data["Creator"]
  @created = DateTime.parse(@data["Created"])
  @lastchange = DateTime.parse(@data["LastChange"])
end

Public Instance Methods

created() click to toggle source
# File lib/ruby_pager/metadata.rb, line 17
def created
  return @created.strftime("%FT%T")
end
created=(ex_created) click to toggle source
# File lib/ruby_pager/metadata.rb, line 21
def created= (ex_created)
  raise(ArgumentError, "Got passed a non DateTime object") if ex_created.class != DateTime
  @created=ex_created
end
creator=(ex_creator) click to toggle source
# File lib/ruby_pager/metadata.rb, line 12
def creator= (ex_creator)
  raise(ArgumentError, "Got passed a non string object") if ex_creator.class != String
  @creator=ex_creator
end
get_consolidated_data() click to toggle source
# File lib/ruby_pager/metadata.rb, line 43
def get_consolidated_data
  consolidate_data()
  return @data
end
lastchange() click to toggle source
# File lib/ruby_pager/metadata.rb, line 26
def lastchange
  return @lastchange.strftime("%FT%T")
end
lastchange=(ex_lastchange) click to toggle source
# File lib/ruby_pager/metadata.rb, line 30
def lastchange= (ex_lastchange)
  raise(ArgumentError, "Got passed a non DateTime object") if ex_lastchange.class != DateTime
  @lastchange=ex_lastchange
end

Private Instance Methods

consolidate_data() click to toggle source
# File lib/ruby_pager/metadata.rb, line 50
def consolidate_data()
  @data["Creator"]=@creator
  @data["Created"]=self.created
  @data["LastChange"]=self.lastchange
end