Sha256: 387c3b5c6be9c305f9a962266f88324443ac550e455bb6f7bb40726288b6fddd

Contents?: true

Size: 610 Bytes

Versions: 5

Compression:

Stored size: 610 Bytes

Contents

module GreyscaleRecord
  module Propertiable
    extend ActiveSupport::Concern

    included do
      class_attribute :__properties
      self.__properties = {}

      class << self
        def properties( props = {} )
          self.__properties = __properties.dup
          merge_properties props
        end

        def property( prop, default = nil )
          merge_properties( { prop => default } )
        end

        protected

        def merge_properties( additional_properties = {} )
          self.__properties = __properties.merge( additional_properties )
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
greyscale_record-1.0.3 lib/greyscale_record/propertiable.rb
greyscale_record-1.0.2 lib/greyscale_record/propertiable.rb
greyscale_record-1.0.1 lib/greyscale_record/propertiable.rb
greyscale_record-1.0.0 lib/greyscale_record/propertiable.rb
greyscale_record-0.0.1 lib/greyscale_record/propertiable.rb