Class: Microformats2::Property::DateTime

Inherits:
Foundation
  • Object
show all
Defined in:
lib/microformats2/property/date_time.rb

Constant Summary

Constants inherited from Foundation

Foundation::VALUE_CLASS_REG_EXP, Foundation::VALUE_TITLE_CLASS_REG_EXP

Instance Attribute Summary

Attributes inherited from Foundation

#method_name

Instance Method Summary collapse

Methods inherited from Foundation

#format, #formats, #initialize, #items, #method_missing, #parse, #to_json, #to_s

Constructor Details

This class inherits a constructor from Microformats2::Property::Foundation

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Microformats2::Property::Foundation

Instance Method Details

#to_hashObject



9
10
11
12
13
14
15
# File 'lib/microformats2/property/date_time.rb', line 9

def to_hash
  if items.empty?
    to_s
  else
    { value: to_s }.merge(items.first.to_hash)
  end
end

#valueObject



5
6
7
# File 'lib/microformats2/property/date_time.rb', line 5

def value
  ::DateTime.parse(to_s)
end