Module: Hash19::CoreHelpers
- Included in:
- Hash19::Core::ClassMethods
- Defined in:
- lib/hash19/core_helpers.rb
Instance Attribute Summary collapse
-
#aliases ⇒ Object
Returns the value of attribute aliases.
-
#contains_klass ⇒ Object
Returns the value of attribute contains_klass.
-
#injections ⇒ Object
Returns the value of attribute injections.
-
#keys ⇒ Object
Returns the value of attribute keys.
-
#many_assocs ⇒ Object
Returns the value of attribute many_assocs.
-
#one_assocs ⇒ Object
Returns the value of attribute one_assocs.
Instance Method Summary collapse
- #attribute(name, opts = {}) ⇒ Object
- #attributes(*list) ⇒ Object
- #contains(class_name) ⇒ Object
- #has_many(name, opts = {}) ⇒ Object
- #has_one(name, opts = {}) ⇒ Object
- #inject(opts) ⇒ Object
Instance Attribute Details
#aliases ⇒ Object
Returns the value of attribute aliases.
5 6 7 |
# File 'lib/hash19/core_helpers.rb', line 5 def aliases @aliases end |
#contains_klass ⇒ Object
Returns the value of attribute contains_klass.
9 10 11 |
# File 'lib/hash19/core_helpers.rb', line 9 def contains_klass @contains_klass end |
#injections ⇒ Object
Returns the value of attribute injections.
8 9 10 |
# File 'lib/hash19/core_helpers.rb', line 8 def injections @injections end |
#keys ⇒ Object
Returns the value of attribute keys.
4 5 6 |
# File 'lib/hash19/core_helpers.rb', line 4 def keys @keys end |
#many_assocs ⇒ Object
Returns the value of attribute many_assocs.
7 8 9 |
# File 'lib/hash19/core_helpers.rb', line 7 def many_assocs @many_assocs end |
#one_assocs ⇒ Object
Returns the value of attribute one_assocs.
6 7 8 |
# File 'lib/hash19/core_helpers.rb', line 6 def one_assocs @one_assocs end |
Instance Method Details
#attribute(name, opts = {}) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/hash19/core_helpers.rb', line 15 def attribute(name, opts = {}) add_attributes(name) if opts.has_key?(:key) @aliases ||= {} @aliases[opts[:key]] = name add_attributes(opts[:key]) end end |
#attributes(*list) ⇒ Object
11 12 13 |
# File 'lib/hash19/core_helpers.rb', line 11 def attributes(*list) add_attributes(*list) end |
#contains(class_name) ⇒ Object
39 40 41 |
# File 'lib/hash19/core_helpers.rb', line 39 def contains(class_name) @contains_klass = class_name end |
#has_many(name, opts = {}) ⇒ Object
29 30 31 32 |
# File 'lib/hash19/core_helpers.rb', line 29 def has_many(name, opts = {}) @many_assocs ||= {} @many_assocs[name] = opts end |
#has_one(name, opts = {}) ⇒ Object
24 25 26 27 |
# File 'lib/hash19/core_helpers.rb', line 24 def has_one(name, opts = {}) @one_assocs ||= {} @one_assocs[name] = opts end |
#inject(opts) ⇒ Object
34 35 36 37 |
# File 'lib/hash19/core_helpers.rb', line 34 def inject(opts) @injections ||= [] @injections << opts end |