Sha256: 37e4a08cafbafd4dace65dc828a24c475af0a9604c9905590c560e5d578d078b

Contents?: true

Size: 471 Bytes

Versions: 1

Compression:

Stored size: 471 Bytes

Contents

module FootStats
  module AttributeAccessor
    def self.included(base)
      base.extend(ClassMethods)
    end

    def attributes
      attrs = Hash.new
      self.class.attributes.each{ |attribute| attrs[attribute] = send attribute }
      attrs
    end

    module ClassMethods
      def attributes
        @attributes ||= []
      end

      def attribute_accessor(*attrs)
        self.attributes.concat attrs
        attr_accessor *attrs
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foot_stats-0.1.0 lib/foot_stats/attribute_accessor.rb