Class: Clowne::Declarations::IncludeAssociation
- Defined in:
- lib/clowne/declarations/include_association.rb
Overview
:nodoc: all
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
- #clone_with ⇒ Object
- #compile(plan) ⇒ Object
-
#initialize(name, scope = nil, **options) ⇒ IncludeAssociation
constructor
A new instance of IncludeAssociation.
- #matches?(names) ⇒ Boolean
- #params ⇒ Object
- #params_proxy ⇒ Object
- #traits ⇒ Object
Constructor Details
#initialize(name, scope = nil, **options) ⇒ IncludeAssociation
Returns a new instance of IncludeAssociation.
12 13 14 15 16 |
# File 'lib/clowne/declarations/include_association.rb', line 12 def initialize(name, scope = nil, **) @name = name.to_sym @scope = scope @options = end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/clowne/declarations/include_association.rb', line 10 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/clowne/declarations/include_association.rb', line 10 def @options end |
#scope ⇒ Object
Returns the value of attribute scope.
10 11 12 |
# File 'lib/clowne/declarations/include_association.rb', line 10 def scope @scope end |
Instance Method Details
#clone_with ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/clowne/declarations/include_association.rb', line 35 def clone_with return @clone_with if instance_variable_defined?(:@clone_with) @clone_with = case [:clone_with] when String, Symbol [:clone_with].to_s.constantize else [:clone_with] end end |
#compile(plan) ⇒ Object
18 19 20 |
# File 'lib/clowne/declarations/include_association.rb', line 18 def compile(plan) plan.add_to(:association, name, self) end |
#matches?(names) ⇒ Boolean
22 23 24 25 |
# File 'lib/clowne/declarations/include_association.rb', line 22 def matches?(names) names = Array(names) names.include?(name) end |
#params ⇒ Object
31 32 33 |
# File 'lib/clowne/declarations/include_association.rb', line 31 def params [:params] end |
#params_proxy ⇒ Object
27 28 29 |
# File 'lib/clowne/declarations/include_association.rb', line 27 def params_proxy @_params_proxy ||= Clowne::Utils::Params.proxy([:params]) end |
#traits ⇒ Object
47 48 49 |
# File 'lib/clowne/declarations/include_association.rb', line 47 def traits [:traits] end |