Class: Sorare::Rewards::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/sorare/rewards/configuration.rb

Overview

Configuration stores the runtime configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
19
# File 'lib/sorare/rewards/configuration.rb', line 12

def initialize
  @tiers = 4
  @gateway = 'https://sorare.mypinata.cloud/ipfs/'
  @transform_tier = ->(tier) { "tier_#{tier}" }
  @transform_division = ->(division) { "D#{division}" }
  @allocation_configuration = load_yaml_configuration_file('allocation_configuration.yml')['leagues']
  @prize_pool_configuration = load_yaml_configuration_file('prize_pool_configuration.yml')['rates']
end

Instance Attribute Details

#allocation_configurationObject

Returns the value of attribute allocation_configuration.



9
10
11
# File 'lib/sorare/rewards/configuration.rb', line 9

def allocation_configuration
  @allocation_configuration
end

#gatewayObject

Returns the value of attribute gateway.



9
10
11
# File 'lib/sorare/rewards/configuration.rb', line 9

def gateway
  @gateway
end

#prize_pool_configurationObject

Returns the value of attribute prize_pool_configuration.



9
10
11
# File 'lib/sorare/rewards/configuration.rb', line 9

def prize_pool_configuration
  @prize_pool_configuration
end

#tiersObject

Returns the value of attribute tiers.



9
10
11
# File 'lib/sorare/rewards/configuration.rb', line 9

def tiers
  @tiers
end

#transform_divisionObject

Returns the value of attribute transform_division.



9
10
11
# File 'lib/sorare/rewards/configuration.rb', line 9

def transform_division
  @transform_division
end

#transform_tierObject

Returns the value of attribute transform_tier.



9
10
11
# File 'lib/sorare/rewards/configuration.rb', line 9

def transform_tier
  @transform_tier
end

Instance Method Details

#load_yaml_configuration_file(filename) ⇒ Object



21
22
23
24
# File 'lib/sorare/rewards/configuration.rb', line 21

def load_yaml_configuration_file(filename)
  YAML.safe_load(File.read("#{File.dirname(__FILE__)}/#{filename}"), aliases: true)
      .with_indifferent_access
end