Sha256: 60c80121856ec3a1c9b7e8a35e1d5c02209b257b650d13d7717204d9f020592c

Contents?: true

Size: 376 Bytes

Versions: 20

Compression:

Stored size: 376 Bytes

Contents

class ProtectedParams < ActiveSupport::HashWithIndifferentAccess
  attr_accessor :permitted
  alias :permitted? :permitted

  def initialize(attributes)
    super(attributes)
    @permitted = false
  end

  def permit!
    @permitted = true
    self
  end

  def dup
    super.tap do |duplicate|
      duplicate.instance_variable_set :@permitted, @permitted
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
active_type-0.6.0 spec/support/protected_params.rb
active_type-0.5.0 spec/support/protected_params.rb
active_type-0.4.5 spec/support/protected_params.rb
active_type-0.4.4 spec/support/protected_params.rb
active_type-0.4.3 spec/support/protected_params.rb
active_type-0.4.2 spec/support/protected_params.rb
active_type-0.4.1 spec/support/protected_params.rb
active_type-0.4.0 spec/support/protected_params.rb
active_type-0.3.5 spec/support/protected_params.rb
active_type-0.3.4 spec/support/protected_params.rb
active_type-0.3.3 spec/support/protected_params.rb
active_type-0.3.2 spec/support/protected_params.rb
active_type-0.3.1 spec/support/protected_params.rb
active_type-0.3.0 spec/support/protected_params.rb
active_type-0.2.1 spec/support/protected_params.rb
active_type-0.2.0 spec/support/protected_params.rb
active_type-0.1.3 spec/support/protected_params.rb
active_type-0.1.2 spec/support/protected_params.rb
active_type-0.1.1 spec/support/protected_params.rb
active_type-0.1.0 spec/support/protected_params.rb