Sha256: ac79ec71f846d98504d79a5c83ff2f5606d364f1870e13bea8e62be15b862313

Contents?: true

Size: 690 Bytes

Versions: 15

Compression:

Stored size: 690 Bytes

Contents

module ActiveRemote
  module Attributes
    # Read attribute from the attributes hash
    #
    def read_attribute(name)
      name = name.to_s

      if respond_to? name
        attribute(name)
      else
        raise ActiveAttr::UnknownAttributeError, "unknown attribute: #{name}"
      end
    end
    alias_method :[], :read_attribute

    # Update an attribute in the attributes hash
    #
    def write_attribute(name, value)
      name = name.to_s

      if respond_to? "#{name}="
        __send__("attribute=", name, value)
      else
        raise ActiveAttr::UnknownAttributeError, "unknown attribute: #{name}"
      end
    end
    alias_method :[]=, :write_attribute
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
active_remote-2.3.2 lib/active_remote/attributes.rb
active_remote-2.3.1 lib/active_remote/attributes.rb
active_remote-2.3.0 lib/active_remote/attributes.rb
active_remote-2.2.0 lib/active_remote/attributes.rb
active_remote-2.1.1 lib/active_remote/attributes.rb
active_remote-2.1.0 lib/active_remote/attributes.rb
active_remote-2.1.0.rc2 lib/active_remote/attributes.rb
active_remote-2.1.0.rc1 lib/active_remote/attributes.rb
active_remote-2.1.0.beta2 lib/active_remote/attributes.rb
active_remote-2.1.0.beta1 lib/active_remote/attributes.rb
active_remote-2.0.2 lib/active_remote/attributes.rb
active_remote-2.0.1 lib/active_remote/attributes.rb
active_remote-2.0.0 lib/active_remote/attributes.rb
active_remote-2.0.0.rc2 lib/active_remote/attributes.rb
active_remote-2.0.0.rc1 lib/active_remote/attributes.rb