Class: Friendly::Associations::Set
- Inherits:
-
Object
- Object
- Friendly::Associations::Set
- Defined in:
- lib/friendly/associations/set.rb
Instance Attribute Summary (collapse)
-
- (Object) association_klass
readonly
Returns the value of attribute association_klass.
-
- (Object) associations
readonly
Returns the value of attribute associations.
-
- (Object) klass
readonly
Returns the value of attribute klass.
Instance Method Summary (collapse)
- - (Object) add(name, options = {})
- - (Object) get(name)
- - (Object) get_scope(name, document)
-
- (Set) initialize(klass, association_klass = Association)
constructor
A new instance of Set.
Constructor Details
- (Set) initialize(klass, association_klass = Association)
A new instance of Set
6 7 8 9 10 |
# File 'lib/friendly/associations/set.rb', line 6 def initialize(klass, association_klass = Association) @klass = klass @association_klass = association_klass @associations = {} end |
Instance Attribute Details
- (Object) association_klass (readonly)
Returns the value of attribute association_klass
4 5 6 |
# File 'lib/friendly/associations/set.rb', line 4 def association_klass @association_klass end |
- (Object) associations (readonly)
Returns the value of attribute associations
4 5 6 |
# File 'lib/friendly/associations/set.rb', line 4 def associations @associations end |
- (Object) klass (readonly)
Returns the value of attribute klass
4 5 6 |
# File 'lib/friendly/associations/set.rb', line 4 def klass @klass end |
Instance Method Details
- (Object) add(name, options = {})
12 13 14 15 |
# File 'lib/friendly/associations/set.rb', line 12 def add(name, = {}) associations[name] = association_klass.new(klass, name, ) add_association_accessor(name) end |
- (Object) get(name)
21 22 23 |
# File 'lib/friendly/associations/set.rb', line 21 def get(name) associations[name] end |
- (Object) get_scope(name, document)
17 18 19 |
# File 'lib/friendly/associations/set.rb', line 17 def get_scope(name, document) get(name).scope(document) end |