Sha256: 156d8c831156dd9f2e9de05df0d45a6304c1ff7b04cf2080fa60845120f3b278

Contents?: true

Size: 652 Bytes

Versions: 18

Compression:

Stored size: 652 Bytes

Contents

module AttributesHelper
  def current_attributes_object
    @_attributes_helper_objects&.last
  end

  def current_attributes_strategy
    @_attributes_helper_strategies&.last
  end

  def with_attribute_settings(options)
    @_attributes_helper_objects ||= []
    @_attributes_helper_strategies ||= []

    if options[:object]
      @_attributes_helper_objects << options[:object]
    end

    if options[:strategy]
      @_attributes_helper_strategies << options[:strategy]
    end

    yield

    if options[:strategy]
      @_attributes_helper_strategies.pop
    end

    if options[:object]
      @_attributes_helper_objects.pop
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
bullet_train-1.2.27 app/helpers/attributes_helper.rb
bullet_train-1.2.26 app/helpers/attributes_helper.rb
bullet_train-1.2.25 app/helpers/attributes_helper.rb
bullet_train-1.2.24 app/helpers/attributes_helper.rb
bullet_train-1.2.23 app/helpers/attributes_helper.rb
bullet_train-1.2.22 app/helpers/attributes_helper.rb
bullet_train-1.2.21 app/helpers/attributes_helper.rb
bullet_train-1.2.20 app/helpers/attributes_helper.rb
bullet_train-1.2.19 app/helpers/attributes_helper.rb
bullet_train-1.2.18 app/helpers/attributes_helper.rb
bullet_train-1.2.17 app/helpers/attributes_helper.rb
bullet_train-1.2.16 app/helpers/attributes_helper.rb
bullet_train-1.2.15 app/helpers/attributes_helper.rb
bullet_train-1.2.14 app/helpers/attributes_helper.rb
bullet_train-1.2.13 app/helpers/attributes_helper.rb
bullet_train-1.2.12 app/helpers/attributes_helper.rb
bullet_train-1.2.11 app/helpers/attributes_helper.rb
bullet_train-1.2.10 app/helpers/attributes_helper.rb