Class: Ethscribe::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/ethscribe.rb

Instance Method Summary collapse

Instance Method Details

#chainObject



27
28
29
30
31
# File 'lib/ethscribe.rb', line 27

def chain
  ## note - default to mainnet if not set
  self.chain = 'mainnet'   unless defined?( @chain )
  @chain
end

#chain=(value) ⇒ Object

accessors



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ethscribe.rb', line 10

def chain=(value)
    if value.is_a?( String ) || value.is_a?( Symbol )
        case value.downcase.to_s
        when 'mainnet'  #  'main', 'eth', 'prod', 'production'
           @chain  = 'mainnet'
           @client = Ethscribe::Api.mainnet
        when 'goerli'   #  'testnet', 'test'
           @chain = 'goerli'
           @client = Ethscribe::Api.goerli
        else
          raise ArgumentError, "unknown chain - expected mainnet | goerli; got #{value}"
        end
    else
        raise ArgumentError, "only string or symbol supported for now; sorry - got: #{value.inspect} : #{value.class.name}"
    end
end

#clientObject

note: read-only for now - why? why not?



34
35
36
37
38
# File 'lib/ethscribe.rb', line 34

def client
  ## note - default to btc/ if not set
  self.chain = 'mainnet'   unless defined?( @client )
  @client
end

#delay_in_sObject Also known as: sleep



40
41
42
43
44
# File 'lib/ethscribe.rb', line 40

def delay_in_s 
  ## note - default to 1 (sec) if not set
  self.delay_in_s = 1   unless defined?( @delay_in_s )
  @delay_in_s
end

#delay_in_s=(value) ⇒ Object Also known as: sleep=



45
# File 'lib/ethscribe.rb', line 45

def delay_in_s=(value) @delay_in_s = value; end