Module: GProv::Provision::EntryBase::ClassMethods

Included in:
GProv::Provision::EntryBase
Defined in:
lib/gprov/provision/entrybase/classmethods.rb

Instance Method Summary collapse

Instance Method Details

#attribute_namesObject



40
41
42
# File 'lib/gprov/provision/entrybase/classmethods.rb', line 40

def attribute_names
  @attrs.map {|a| a.name }
end

#attribute_titlesObject

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

#attributesObject

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, options={}, &block)
  attr = GProv::Provision::EntryBase::XMLAttr.new(name, options)
  attr.instance_eval &block if block_given?
  @attrs ||= []
  @attrs << attr
  attr_accessor name
end