Class: HTMLSchema::API::Object
- Inherits:
-
Object
- Object
- Object
- HTMLSchema::API::Object
show all
- Defined in:
- lib/html-schema/api/object.rb
Instance Attribute Summary
Attributes inherited from Object
#_name, #as, #attributes, #classes, #parent, #source, #types
Instance Method Summary
collapse
Methods inherited from Object
#[], #attribute, #initialize, #inspect, #type
Instance Method Details
#microdata ⇒ Object
5
6
7
|
# File 'lib/html-schema/api/object.rb', line 5
def microdata
@microdata ||= HTMLSchema.instance.microdata[_name]
end
|
9
10
11
|
# File 'lib/html-schema/api/object.rb', line 9
def microformat
@microformat ||= HTMLSchema.instance.microformat[_name]
end
|
13
14
15
16
17
18
|
# File 'lib/html-schema/api/object.rb', line 13
def to_hash
result = {}
deep_merge(result, microdata.to_hash) if microdata
deep_merge(result, microformat.to_hash) if microformat
result
end
|
#to_object ⇒ Object
20
21
22
23
24
25
|
# File 'lib/html-schema/api/object.rb', line 20
def to_object
result = {}
deep_merge(result, microdata.to_object) if microdata
deep_merge(result, microformat.to_object) if microformat
result
end
|