Class: Jacoat::Document::Meta

Inherits:
Object
  • Object
show all
Defined in:
lib/jacoat/document/meta.rb

Instance Method Summary collapse

Constructor Details

#initialize(arguments = {}) ⇒ Meta

Returns a new instance of Meta.



4
5
6
7
# File 'lib/jacoat/document/meta.rb', line 4

def initialize(arguments = {})
  @hash = {}
  process_meta(arguments)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/jacoat/document/meta.rb', line 9

def method_missing(m, *args)
  #setter
  if /^(\w+)=$/ =~ m 
    @hash[:"#{$1}"] = args[0]
  end
  #getter
  @hash[:"#{m}"]
end

Instance Method Details

#to_hashObject



18
19
20
# File 'lib/jacoat/document/meta.rb', line 18

def to_hash
  @hash
end