Class: Sorare::Rewards::Configuration
- Inherits:
-
Object
- Object
- Sorare::Rewards::Configuration
- Defined in:
- lib/sorare/rewards/configuration.rb
Overview
Configuration stores the runtime configuration
Instance Attribute Summary collapse
-
#allocation_configuration ⇒ Object
Returns the value of attribute allocation_configuration.
-
#gateway ⇒ Object
Returns the value of attribute gateway.
-
#prize_pool_configuration ⇒ Object
Returns the value of attribute prize_pool_configuration.
-
#tiers ⇒ Object
Returns the value of attribute tiers.
-
#transform_division ⇒ Object
Returns the value of attribute transform_division.
-
#transform_tier ⇒ Object
Returns the value of attribute transform_tier.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load_yaml_configuration_file(filename) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
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_configuration ⇒ Object
Returns the value of attribute allocation_configuration.
9 10 11 |
# File 'lib/sorare/rewards/configuration.rb', line 9 def allocation_configuration @allocation_configuration end |
#gateway ⇒ Object
Returns the value of attribute gateway.
9 10 11 |
# File 'lib/sorare/rewards/configuration.rb', line 9 def gateway @gateway end |
#prize_pool_configuration ⇒ Object
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 |
#tiers ⇒ Object
Returns the value of attribute tiers.
9 10 11 |
# File 'lib/sorare/rewards/configuration.rb', line 9 def tiers @tiers end |
#transform_division ⇒ Object
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_tier ⇒ Object
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 |