Class: Rasti::DB::Relations::Base
- Inherits:
-
Object
- Object
- Rasti::DB::Relations::Base
show all
- Includes:
- Sequel::Inflections
- Defined in:
- lib/rasti/db/relations.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name, source_collection_class, options = {}) ⇒ Base
Returns a new instance of Base.
36
37
38
39
40
|
# File 'lib/rasti/db/relations.rb', line 36
def initialize(name, source_collection_class, options={})
@name = name
@source_collection_class = source_collection_class
@options = options
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
34
35
36
|
# File 'lib/rasti/db/relations.rb', line 34
def name
@name
end
|
#source_collection_class ⇒ Object
Returns the value of attribute source_collection_class.
34
35
36
|
# File 'lib/rasti/db/relations.rb', line 34
def source_collection_class
@source_collection_class
end
|
Instance Method Details
#many_to_many? ⇒ Boolean
54
55
56
|
# File 'lib/rasti/db/relations.rb', line 54
def many_to_many?
is_a? ManyToMany
end
|
#many_to_one? ⇒ Boolean
50
51
52
|
# File 'lib/rasti/db/relations.rb', line 50
def many_to_one?
is_a? ManyToOne
end
|
#one_to_many? ⇒ Boolean
46
47
48
|
# File 'lib/rasti/db/relations.rb', line 46
def one_to_many?
is_a? OneToMany
end
|
#target_collection_class ⇒ Object
42
43
44
|
# File 'lib/rasti/db/relations.rb', line 42
def target_collection_class
@target_collection_class ||= @options[:collection].is_a?(Class) ? @options[:collection] : Consty.get(@options[:collection] || camelize(pluralize(name)), source_collection_class)
end
|