Sha256: 9f21682cb436275f73fcaa391364bccaad1adfcc6a1f4068fa981f89d64a62a3

Contents?: true

Size: 725 Bytes

Versions: 102

Compression:

Stored size: 725 Bytes

Contents

module AttributesHelper
  def current_attributes_object
    @_attributes_helper_objects ? @_attributes_helper_objects.last : nil
  end

  def current_attributes_strategy
    @_attributes_helper_strategies ? @_attributes_helper_strategies.last : nil
  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

102 entries across 102 versions & 1 rubygems

Version Path
bullet_train-1.2.9 app/helpers/attributes_helper.rb
bullet_train-1.2.8 app/helpers/attributes_helper.rb
bullet_train-1.2.7 app/helpers/attributes_helper.rb
bullet_train-1.2.6 app/helpers/attributes_helper.rb
bullet_train-1.2.5 app/helpers/attributes_helper.rb
bullet_train-1.2.4 app/helpers/attributes_helper.rb
bullet_train-1.2.3 app/helpers/attributes_helper.rb
bullet_train-1.2.2 app/helpers/attributes_helper.rb
bullet_train-1.2.1 app/helpers/attributes_helper.rb
bullet_train-1.2.0 app/helpers/attributes_helper.rb
bullet_train-1.1.10 app/helpers/attributes_helper.rb
bullet_train-1.1.9 app/helpers/attributes_helper.rb
bullet_train-1.1.7 app/helpers/attributes_helper.rb
bullet_train-1.1.6 app/helpers/attributes_helper.rb
bullet_train-1.1.5 app/helpers/attributes_helper.rb
bullet_train-1.1.4 app/helpers/attributes_helper.rb
bullet_train-1.1.3 app/helpers/attributes_helper.rb
bullet_train-1.1.2 app/helpers/attributes_helper.rb
bullet_train-1.1.1 app/helpers/attributes_helper.rb
bullet_train-1.1.0 app/helpers/attributes_helper.rb