Class: Flickr::Config
- Inherits:
-
Object
- Object
- Flickr::Config
- Defined in:
- lib/flickr.rb
Overview
This class supports external configuration
Constant Summary
- @@configuration =
Contains whole configuration for flickr API
{}
- @@parsed =
Is true if configuration has been parsed
false
Class Method Summary (collapse)
-
+ (Object) get
Returns configuration Hash.
-
+ (Object) load_from_file(file)
parses file and prepare @@configuration for access from outside to fetch configuration hash.
-
+ (Object) parse_in_rails_env!
Excludes specific configuration for choosed environment in Rails.
-
+ (Boolean) parsed?
Returns true if configuration has been parsed.
Class Method Details
+ (Object) get
Returns configuration Hash
270 271 272 |
# File 'lib/flickr.rb', line 270 def self.get @@configuration end |
+ (Object) load_from_file(file)
parses file and prepare @@configuration for access from outside to fetch configuration hash
257 258 259 260 261 262 |
# File 'lib/flickr.rb', line 257 def self.load_from_file file return false unless File.exist?(file) @@configuration = YAML.load(ERB.new(File.read(file)).result) @@parsed = true parse_in_rails_env! end |
+ (Object) parse_in_rails_env!
Excludes specific configuration for choosed environment in Rails
265 266 267 |
# File 'lib/flickr.rb', line 265 def self.parse_in_rails_env! @@configuration = @@configuration[RAILS_ENV].symbolize_keys if defined? RAILS_ENV and @@configuration.has_key? RAILS_ENV end |
+ (Boolean) parsed?
Returns true if configuration has been parsed
275 276 277 |
# File 'lib/flickr.rb', line 275 def self.parsed? @@parsed end |