Class: Mixture::AttributeList
- Inherits:
-
Object
- Object
- Mixture::AttributeList
- Extended by:
- Forwardable
- Includes:
- Comparable, Enumerable
- Defined in:
- lib/mixture/attribute_list.rb
Overview
A list of attributes. This is used instead of a hash in order to add in the #options and #callbacks.
Instance Attribute Summary collapse
-
#callbacks ⇒ Hash{Symbol => Array<Proc>}
readonly
Returns a set of callbacks.
-
#options ⇒ Hash{Symbol => Object}
readonly
Returns a set of options used for the attributes.
Instance Method Summary collapse
-
#create(name, options = {}) ⇒ Attribute
Creates a new attribute with the given name and options.
-
#initialize ⇒ AttributeList
constructor
Initializes the attribute list.
Constructor Details
#initialize ⇒ AttributeList
Initializes the attribute list.
30 31 32 33 34 |
# File 'lib/mixture/attribute_list.rb', line 30 def initialize @list = {} @options = {} @callbacks = Hash.new { |h, k| h[k] = [] } end |
Instance Attribute Details
#callbacks ⇒ Hash{Symbol => Array<Proc>} (readonly)
Returns a set of callbacks. This is used for coercion, but may be used for other things.
27 28 29 |
# File 'lib/mixture/attribute_list.rb', line 27 def callbacks @callbacks end |
#options ⇒ Hash{Symbol => Object} (readonly)
Returns a set of options used for the attributes. This isn't used at the moment.
21 22 23 |
# File 'lib/mixture/attribute_list.rb', line 21 def @options end |