Sha256: 90a34a3e98898cb2ae6b2be604e91ad830bb99cc63a0e3a7c5cacdee4d931f64

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

# encoding: utf-8

module SayWhen
  module Storage
    module Memory

      module Base

        attr_accessor :props

        def has_properties(*args)
          @props ||= []
          args.each do |a|
            unless @props.member?(a.to_s)
              @props << a.to_s
              class_eval { attr_accessor(a.to_sym) }
            end
          end
        end

        def self.included(base)
          base.extend self
        end

        def initialize(args={})
          args.each do |k,v|
            if self.class.props.member?(k.to_s)
              self.send("#{k}=", v)
            end
          end
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
say_when-1.0.0 lib/say_when/storage/memory/base.rb