Module: AttributesHelper

Defined in:
app/helpers/attributes_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_attributes_objectObject



2
3
4
# File 'app/helpers/attributes_helper.rb', line 2

def current_attributes_object
  @_current_attribute_settings&.dig(:object)
end

#current_attributes_strategyObject



6
7
8
# File 'app/helpers/attributes_helper.rb', line 6

def current_attributes_strategy
  @_current_attribute_settings&.dig(:strategy)
end

#with_attribute_settings(object: current_attributes_object, strategy: current_attributes_strategy) ⇒ Object



10
11
12
13
14
15
16
# File 'app/helpers/attributes_helper.rb', line 10

def with_attribute_settings(object: current_attributes_object, strategy: current_attributes_strategy)
  old_attribute_settings = @_current_attribute_settings
  @_current_attribute_settings = {object: object, strategy: strategy}
  yield
ensure
  @_current_attribute_settings = old_attribute_settings
end