Class: Jacoat::Document::Meta
- Inherits:
-
Object
- Object
- Jacoat::Document::Meta
show all
- Defined in:
- lib/jacoat/document/meta.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(arguments = {}) ⇒ Meta
Returns a new instance of Meta.
10
11
12
|
# File 'lib/jacoat/document/meta.rb', line 10
def initialize(arguments = {})
@hash = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/jacoat/document/meta.rb', line 14
def method_missing(m, *args)
if /^(\w+)=$/ =~ m
@hash[:"#{$1}"] = args[0]
end
@hash[:"#{m}"]
end
|
Class Method Details
.from_jsonapi(arguments) ⇒ Object
4
5
6
7
8
|
# File 'lib/jacoat/document/meta.rb', line 4
def self.from_jsonapi(arguments)
meta = Meta.new
meta.process_meta(arguments)
meta
end
|
Instance Method Details
27
28
29
30
31
|
# File 'lib/jacoat/document/meta.rb', line 27
def process_meta(arguments)
arguments.each_pair do |k, v|
send("#{k}=", v)
end
end
|
#to_hash ⇒ Object
23
24
25
|
# File 'lib/jacoat/document/meta.rb', line 23
def to_hash
@hash
end
|