Class: CommunityZero::Metadata
- Inherits:
-
Object
- Object
- CommunityZero::Metadata
- Defined in:
- lib/community_zero/chef/metadata.rb
Overview
A quick, short metadata parser.
Instance Method Summary collapse
-
#initialize(content) ⇒ Metadata
constructor
Create a new metadata class.
- #method_missing(m, *args, &block) ⇒ Object
- #respond_to?(m) ⇒ Boolean
Constructor Details
#initialize(content) ⇒ Metadata
Create a new metadata class.
27 28 29 |
# File 'lib/community_zero/chef/metadata.rb', line 27 def initialize(content) instance_eval(content) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/community_zero/chef/metadata.rb', line 31 def method_missing(m, *args, &block) if args.empty? data[m.to_sym] else data[m.to_sym] = args.size == 1 ? args[0] : args end end |
Instance Method Details
#respond_to?(m) ⇒ Boolean
39 40 41 |
# File 'lib/community_zero/chef/metadata.rb', line 39 def respond_to?(m) !!data[m.to_sym] end |