Class: UnionPay::Core::Config
- Inherits:
-
Object
- Object
- UnionPay::Core::Config
- Defined in:
- lib/union-pay/core/config.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(config) ⇒ Config
Returns a new instance of Config.
8 9 10 |
# File 'lib/union-pay/core/config.rb', line 8 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/union-pay/core/config.rb', line 7 def config @config end |
Class Method Details
.mobile_config(file_name, env = 'development') ⇒ Object
19 20 21 22 23 |
# File 'lib/union-pay/core/config.rb', line 19 def self.mobile_config(file_name, env='development') config = read_config_file(file_name)['mobile'][env] config = Utils.key_to_sym(config) new(config) end |
.read_config_file(file_name) ⇒ Object
12 13 14 15 16 |
# File 'lib/union-pay/core/config.rb', line 12 def self.read_config_file(file_name) erb = ERB.new(File.read(file_name)) erb.filename = file_name YAML.load(erb.result) end |