Class: SimpleGoogleCustomSearch::SgcsConfig
- Inherits:
-
Object
- Object
- SimpleGoogleCustomSearch::SgcsConfig
- Defined in:
- lib/simple_google_custom_search/sgcs_config.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
Instance Method Summary collapse
- #get_config ⇒ Object
-
#initialize ⇒ SgcsConfig
constructor
A new instance of SgcsConfig.
Constructor Details
#initialize ⇒ SgcsConfig
Returns a new instance of SgcsConfig.
4 5 6 7 8 9 10 |
# File 'lib/simple_google_custom_search/sgcs_config.rb', line 4 def initialize raise 'Please set constant variable SGCS_CONFIG' unless defined?(SGCS_CONFIG) config = SGCS_CONFIG.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} raise 'Please set constant variable SGCS_CONFIG[:domain]' if config[:domain].nil? @domain = config[:domain] end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
2 3 4 |
# File 'lib/simple_google_custom_search/sgcs_config.rb', line 2 def domain @domain end |
Instance Method Details
#get_config ⇒ Object
12 13 14 15 16 |
# File 'lib/simple_google_custom_search/sgcs_config.rb', line 12 def get_config @config ||= { domain: @domain } end |