class Olelo::Attributes::AttributeDSL
DSL class used to initialize AttributeGroup
Public Class Methods
new(group, &block)
click to toggle source
Initialize DSL with ‘group`
@param [Olelo::Attributes::AttributeGroup] AttributeGroup
to modify in this DSL block @yield DSL block
# File lib/olelo/attributes.rb, line 191 def initialize(group, &block) @group = group instance_eval(&block) end
Public Instance Methods
boolean(name)
click to toggle source
# File lib/olelo/attributes.rb, line 208 def boolean(name) @group.children[name.to_s] = Attribute::Boolean.new(@group, name) end
enum(name, values = nil, &block)
click to toggle source
# File lib/olelo/attributes.rb, line 216 def enum(name, values = nil, &block) @group.children[name.to_s] = Attribute::Enum.new(@group, name, block ? block : values) end
group(name, &block)
click to toggle source
Define attribute group
@yield DSL block @return [void] @api public
# File lib/olelo/attributes.rb, line 226 def group(name, &block) AttributeDSL.new(@group.children[name.to_s] ||= AttributeGroup.new(@group, name), &block) end
integer(name)
click to toggle source
# File lib/olelo/attributes.rb, line 204 def integer(name) @group.children[name.to_s] = Attribute::Integer.new(@group, name) end
list(name)
click to toggle source
# File lib/olelo/attributes.rb, line 212 def list(name) @group.children[name.to_s] = Attribute::List.new(@group, name) end
string(name, values = nil, &block)
click to toggle source
# File lib/olelo/attributes.rb, line 196 def string(name, values = nil, &block) @group.children[name.to_s] = if values || block Attribute::Suggestions.new(@group, name, block ? block : values) else Attribute::String.new(@group, name) end end