Sha256: 5a7a26c018a0d1dd22e6840ed757d9abfdb6e27821abdd6a22af47067a4df946

Contents?: true

Size: 597 Bytes

Versions: 3

Compression:

Stored size: 597 Bytes

Contents

require 'active_support/core_ext/hash/indifferent_access'
module ActiveHash
  module ARApi

    module Init

      attr_reader :associations, :types

      def initialize(attributes = {}, &block)
        @types = {}
        yield self if block_given?
        attributes.each do |key, value|
          begin
            send "#{key}=", value
          rescue NoMethodError
            raise ActiveMocker::RejectedParams, "{:#{key}=>#{value.inspect}} for #{self.class.name}"
          end
        end

      end



    end
  end

end

module ActiveMocker
  class RejectedParams < Exception
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_mocker-1.3.2 lib/active_hash/init.rb
active_mocker-1.3.1 lib/active_hash/init.rb
active_mocker-1.3 lib/active_hash/init.rb