Class: Mixture::AttributeList

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Comparable, Enumerable
Defined in:
lib/mixture/attribute_list.rb

Overview

A list of attributes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAttributeList

Returns a new instance of AttributeList.



19
20
21
22
23
# File 'lib/mixture/attribute_list.rb', line 19

def initialize
  @list = {}
  @options = {}
  @callbacks = Hash.new { |h, k| h[k] = [] }
end

Instance Attribute Details

#callbacksObject (readonly)

Returns the value of attribute callbacks.



17
18
19
# File 'lib/mixture/attribute_list.rb', line 17

def callbacks
  @callbacks
end

#optionsObject (readonly)

Returns the value of attribute options.



16
17
18
# File 'lib/mixture/attribute_list.rb', line 16

def options
  @options
end

Instance Method Details

#create(name, options = {}) ⇒ Object



25
26
27
# File 'lib/mixture/attribute_list.rb', line 25

def create(name, options = {})
  @list[name] = Attribute.new(name, self, options)
end