Sha256: fd53b505741cf85708d55b6e1a241e9fc419f66c613d10acca59e45d1c428407
Contents?: true
Size: 1.22 KB
Versions: 11
Compression:
Stored size: 1.22 KB
Contents
module GenesisRuby module Api module Constants module States # Genesis Response Status definitions class State # Helper method for defining available dynamic methods def self.handle_respond_to_states(symbol) name = symbol.to_s.downcase name.slice!('?') == '?' && GenesisRuby::Api::Constants::States.valid?(name) end attr_accessor :state def initialize(state) @state = state end # States dynamic methods. Must be valid Genesis Transaction State # Ex. new?, approved? def method_missing(symbol, *args) name = symbol.to_s.upcase super unless GenesisRuby::Api::Constants::States::State.handle_respond_to_states(name) name.chomp! '?' GenesisRuby::Api::Constants::States.valid?(name) && state == GenesisRuby::Api::Constants::States.const_get(name) end # Respond to missing implementation def respond_to_missing?(symbol, include_private = false) GenesisRuby::Api::Constants::States::State.handle_respond_to_states(symbol) || super end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems