class Steem::Operation

Constants

IDS

IDs derrived from: github.com/steemit/steem/blob/127a441fbac2f06804359968bda83b66e602c891/libraries/protocol/include/steem/protocol/operations.hpp

Public Class Methods

op_id(op) click to toggle source
# File lib/steem/operation.rb, line 94
def self.op_id(op)
  IDS.find_index op
end

Public Instance Methods

==(other_op) click to toggle source
# File lib/steem/operation.rb, line 131
def ==(other_op)
  return false if self.class != other_op.class
  
  self.class.attributes.each do |prop|
    return false if self[prop] != other_op[prop]
  end
  
  true
end
[](key) click to toggle source
# File lib/steem/operation.rb, line 114
def [](key)
  key = key.to_sym
  send(key) if self.class.attributes.include?(key)
end
[]=(key, value) click to toggle source
# File lib/steem/operation.rb, line 119
def []=(key, value)
  key = key.to_sym
  
  if self.class.attributes.include?(key)
    if self.class.numeric? key
      send("#{key}=", value.to_i)
    else
      send("#{key}=", value)
    end
  end
end
inspect() click to toggle source
# File lib/steem/operation.rb, line 98
def inspect
  properties = self.class.attributes.map do |prop|
    unless (v = instance_variable_get("@#{prop}")).nil?
      v = if v.respond_to? :strftime
        v.strftime('%Y-%m-%dT%H:%M:%S')
      else
        v
      end
      
      "@#{prop}=#{v}"
    end
  end.compact.join(', ')
  
  "#<#{self.class.name} [#{properties}]>"
end