renames Property::Foundation#value to #to_s
This commit is contained in:
parent
f78e158b7c
commit
a33ce3f699
4 changed files with 28 additions and 30 deletions
|
@ -1,21 +1,19 @@
|
|||
module Microformats2
|
||||
module Property
|
||||
class DateTime < Foundation
|
||||
def value
|
||||
::DateTime.parse(string_value)
|
||||
rescue ArgumentError => e
|
||||
string_value
|
||||
def to_s
|
||||
@to_s ||= value_class_pattern || element_value || text_value
|
||||
end
|
||||
|
||||
def string_value
|
||||
@string_value ||= value_class_pattern || element_value || text_value
|
||||
def value
|
||||
::DateTime.parse(to_s)
|
||||
end
|
||||
|
||||
def to_hash
|
||||
if formats.empty?
|
||||
string_value.to_s
|
||||
to_s
|
||||
else
|
||||
{ value: string_value.to_s }.merge(formats.first.to_hash)
|
||||
{ value: to_s }.merge(formats.first.to_hash)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module Microformats2
|
||||
module Property
|
||||
class Embedded < Foundation
|
||||
def value
|
||||
@value ||= @element.inner_html.strip
|
||||
def to_s
|
||||
@to_s ||= @element.inner_html.strip
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,13 +9,13 @@ module Microformats2
|
|||
end
|
||||
|
||||
def parse
|
||||
value
|
||||
to_s
|
||||
formats
|
||||
self
|
||||
end
|
||||
|
||||
def value
|
||||
@value ||= value_class_pattern || element_value || text_value
|
||||
def to_s
|
||||
@to_s ||= value_class_pattern || element_value || text_value
|
||||
end
|
||||
|
||||
def formats
|
||||
|
@ -24,9 +24,9 @@ module Microformats2
|
|||
|
||||
def to_hash
|
||||
if formats.empty?
|
||||
value.to_s
|
||||
to_s
|
||||
else
|
||||
{ value: value.to_s }.merge(formats.first.to_hash)
|
||||
{ value: to_s }.merge(formats.first.to_hash)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue