Class: BinanceClient::MarketFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/binance_client/models/market_filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_hash:) ⇒ MarketFilter

Returns a new instance of MarketFilter.



6
7
8
# File 'lib/binance_client/models/market_filter.rb', line 6

def initialize(raw_hash:)
  @raw_hash = raw_hash
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/binance_client/models/market_filter.rb', line 10

def method_missing(method_name, *args)
  key = method_name.to_s.camelcase(:lower)
  super if raw_hash[key].nil?

  self.class.define_method method_name do
    value = raw_hash[method_name.to_s.camelcase(:lower)]

    value = value.to_d if value =~ /^[\d\.]+$/

    value
  end
  send(method_name)
end

Instance Attribute Details

#raw_hashObject (readonly)

Returns the value of attribute raw_hash.



4
5
6
# File 'lib/binance_client/models/market_filter.rb', line 4

def raw_hash
  @raw_hash
end