Module: ActiveRecordSeek::Concerns::InstanceVariableConcern
- Extended by:
- ActiveSupport::Concern
- Included in:
- ActiveRecordSeek::Component, Operators::BaseOperator, Query, Scopes::AssociationScope::Jump, Scopes::AssociationScope::JumpPlan, Scopes::BaseScope
- Defined in:
- lib/active_record_seek/concerns/instance_variable_concern.rb
Instance Method Summary collapse
- #after_initialize ⇒ Object
- #initialize(variables = {}) ⇒ Object
- #instance_variable_reset(variable, &block) ⇒ Object
- #instance_variable_yield(variable) ⇒ Object
- #set(params = {}) ⇒ Object
Instance Method Details
#after_initialize ⇒ Object
12 13 14 |
# File 'lib/active_record_seek/concerns/instance_variable_concern.rb', line 12 def after_initialize # noop end |
#initialize(variables = {}) ⇒ Object
7 8 9 10 |
# File 'lib/active_record_seek/concerns/instance_variable_concern.rb', line 7 def initialize(variables = {}) set(variables) after_initialize end |
#instance_variable_reset(variable, &block) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/active_record_seek/concerns/instance_variable_concern.rb', line 21 def instance_variable_reset(variable, &block) if instance_variable_defined?(variable) remove_instance_variable(variable) true else false end end |
#instance_variable_yield(variable) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/active_record_seek/concerns/instance_variable_concern.rb', line 30 def instance_variable_yield(variable) if instance_variable_defined?(variable) value = instance_variable_get(variable) yield(value) value end end |
#set(params = {}) ⇒ Object
16 17 18 19 |
# File 'lib/active_record_seek/concerns/instance_variable_concern.rb', line 16 def set(params = {}) params.each { |key, value| send("#{key}=", value) } self end |