Module: Ghaki::Meta::Builder::ClassMethods
- Defined in:
- lib/ghaki/meta/builder.rb
Instance Method Summary collapse
-
#attr_meta_builder(*tokens) ⇒ Object
Declare meta builder attributes.
-
#meta_builders ⇒ Object
Getter for the meta builder helper object.
-
#set_meta_builder(pairs) ⇒ Object
Assign classes to meta builder attributes.
Instance Method Details
#attr_meta_builder(*tokens) ⇒ Object
Declare meta builder attributes.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ghaki/meta/builder.rb', line 37 def *tokens @meta_builders ||= {} tokens.each do |token| @meta_builders[token] = nil module_eval <<-"END" def #{token} ; @#{token} end def #{token}= val ; @#{token} = val end END end end |
#meta_builders ⇒ Object
Getter for the meta builder helper object.
32 33 34 |
# File 'lib/ghaki/meta/builder.rb', line 32 def @meta_builders ||= {} end |
#set_meta_builder(pairs) ⇒ Object
Assign classes to meta builder attributes.
49 50 51 52 53 54 |
# File 'lib/ghaki/meta/builder.rb', line 49 def pairs pairs.each_pair do |token,klass| (token) unless .has_key?(token) self.[token] = klass end end |