Sha256: f53640e6e5d21e90c45377d5b621b359bf94b7bc87359f264be9c39a0672cf03

Contents?: true

Size: 489 Bytes

Versions: 3

Compression:

Stored size: 489 Bytes

Contents

module BitmaskAttribute
  module Attribute
    attr_accessor :attributes
    
    def initialize(attrs = {})
      @attributes = {}
      attrs.each do |k,v|
        sym = :"#{k}="
        if respond_to? sym
          send sym, v
        else
          write_attribute(k, v)
        end
      end
    end

    def read_attribute(attr_name)
      @attributes[attr_name.to_s]
    end
    
    def write_attribute(attr_name, value)
      @attributes[attr_name.to_s] = value
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
clean-bitmask-attribute-2.0.3 lib/bitmask_attribute/attribute.rb
clean-bitmask-attribute-2.0.1 lib/bitmask_attribute/attribute.rb
clean-bitmask-attribute-2.0.0 lib/bitmask_attribute/attribute.rb