class RubyEventStore::Metadata

Constants

SAFE_HASH_METHODS

Public Class Methods

new(h = self) click to toggle source
# File lib/ruby_event_store/metadata.rb, line 12
def initialize(h = self)
  @h = {}
  h.each { |k, v| self[k] = (v) }
end

Public Instance Methods

[](key) click to toggle source
# File lib/ruby_event_store/metadata.rb, line 17
def [](key)
  raise ArgumentError unless Symbol === key
  @h[key]
end
[]=(key, val) click to toggle source
# File lib/ruby_event_store/metadata.rb, line 22
def []=(key, val)
  raise ArgumentError unless allowed_types.any? { |klass| klass === val }
  raise ArgumentError unless Symbol === key
  @h[key] = val
end
each(&block) click to toggle source
# File lib/ruby_event_store/metadata.rb, line 28
def each(&block)
  @h.each(&block)
end

Private Instance Methods

allowed_types() click to toggle source
# File lib/ruby_event_store/metadata.rb, line 76
def allowed_types
  [String, Integer, Float, Date, Time, TrueClass, FalseClass, nil, Hash, Array]
end