Module: GProv::Provision::EntryBase::ClassMethods
- Included in:
- GProv::Provision::EntryBase
- Defined in:
- lib/gprov/provision/entrybase/classmethods.rb
Instance Method Summary collapse
- #attribute_names ⇒ Object
-
#attribute_titles ⇒ Object
Transforms standard ruby attribute names to something slightly more human readable.
-
#attributes ⇒ Object
Provides an ordered list of xml attributes.
-
#xmlattr(name, options = {}, &block) ⇒ Object
Generates xmlattrs and encapsulates parsing logic.
Instance Method Details
#attribute_names ⇒ Object
40 41 42 |
# File 'lib/gprov/provision/entrybase/classmethods.rb', line 40 def attribute_names @attrs.map {|a| a.name } end |
#attribute_titles ⇒ Object
Transforms standard ruby attribute names to something slightly more human readable.
46 47 48 |
# File 'lib/gprov/provision/entrybase/classmethods.rb', line 46 def attribute_titles attribute_names.map {|f| f.to_s.capitalize.sub(/$/, ":").gsub(/_/, " ") } end |
#attributes ⇒ Object
Provides an ordered list of xml attributes. Mainly used to give a list of attributes in a specific order.
36 37 38 |
# File 'lib/gprov/provision/entrybase/classmethods.rb', line 36 def attributes @attrs end |
#xmlattr(name, options = {}, &block) ⇒ Object
Generates xmlattrs and encapsulates parsing logic
23 24 25 26 27 28 29 |
# File 'lib/gprov/provision/entrybase/classmethods.rb', line 23 def xmlattr(name, ={}, &block) attr = GProv::Provision::EntryBase::XMLAttr.new(name, ) attr.instance_eval &block if block_given? @attrs ||= [] @attrs << attr attr_accessor name end |