class Harold::Operation

Constants

VALID_TYPES

Attributes

attributes[R]
id[R]
payload[R]
type[R]

Public Class Methods

new(id, type, payload = {}, attributes = {}) click to toggle source
# File lib/operation.rb, line 6
def initialize(id, type, payload = {}, attributes = {})
  unless VALID_TYPES.include?(type)
    raise ArgumentError,
          "#{type} is not a valid type"
  end

  @id = id
  @type = type
  @payload = payload
  @attributes = attributes

  attributes.each_pair do |key, val|
    define_singleton_method(key) { val }
  end
end