Module: Hash19::CoreHelpers

Included in:
Hash19::Core::ClassMethods
Defined in:
lib/hash19/core_helpers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aliasesObject

Returns the value of attribute aliases.



5
6
7
# File 'lib/hash19/core_helpers.rb', line 5

def aliases
  @aliases
end

#contains_klassObject

Returns the value of attribute contains_klass.



9
10
11
# File 'lib/hash19/core_helpers.rb', line 9

def contains_klass
  @contains_klass
end

#injectionsObject

Returns the value of attribute injections.



8
9
10
# File 'lib/hash19/core_helpers.rb', line 8

def injections
  @injections
end

#keysObject

Returns the value of attribute keys.



4
5
6
# File 'lib/hash19/core_helpers.rb', line 4

def keys
  @keys
end

#many_assocsObject

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_assocsObject

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
# File 'lib/hash19/core_helpers.rb', line 15

def attribute(name, opts = {})
  add_attributes(opts[:key] || name)
  @aliases ||= {}
  @aliases[opts[:key]] = name if opts.has_key?(:key)
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



36
37
38
# File 'lib/hash19/core_helpers.rb', line 36

def contains(class_name)
  @contains_klass = class_name
end

#has_many(name, opts = {}) ⇒ Object



26
27
28
29
# File 'lib/hash19/core_helpers.rb', line 26

def has_many(name, opts = {})
  @many_assocs ||= {}
  @many_assocs[name] = opts
end

#has_one(name, opts = {}) ⇒ Object



21
22
23
24
# File 'lib/hash19/core_helpers.rb', line 21

def has_one(name, opts = {})
  @one_assocs ||= {}
  @one_assocs[name] = opts
end

#inject(opts) ⇒ Object



31
32
33
34
# File 'lib/hash19/core_helpers.rb', line 31

def inject(opts)
  @injections ||= []
  @injections << opts
end