Class: Tienda::Settings
- Inherits:
-
Object
show all
- Defined in:
- lib/tienda/settings.rb
Instance Method Summary
collapse
Constructor Details
#initialize(hash) ⇒ Settings
Returns a new instance of Settings.
3
4
5
|
# File 'lib/tienda/settings.rb', line 3
def initialize(hash)
@hash = hash
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, _ = nil) ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/tienda/settings.rb', line 11
def method_missing(key, _ = nil)
key = key.to_s.gsub(/\?\z/, '')
if value = @hash[key.to_s]
value
elsif I18n.translate('tienda.settings.defaults').keys.include?(key.to_sym)
I18n.translate('tienda.settings.defaults')[key.to_sym]
end
end
|
Instance Method Details
#[](value) ⇒ Object
20
21
22
|
# File 'lib/tienda/settings.rb', line 20
def [](value)
@hash[value]
end
|
#outbound_email_address ⇒ Object
7
8
9
|
# File 'lib/tienda/settings.rb', line 7
def outbound_email_address
"#{store_name} <#{email_address}>"
end
|