Class: Pith::ConfigProvider
- Inherits:
-
Object
- Object
- Pith::ConfigProvider
- Includes:
- Observable
- Defined in:
- lib/pith/config_provider.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(project) ⇒ ConfigProvider
constructor
A new instance of ConfigProvider.
- #sync ⇒ Object
Methods included from Observable
#add_observer, #notify_observers, #remove_observer
Constructor Details
#initialize(project) ⇒ ConfigProvider
Returns a new instance of ConfigProvider.
10 11 12 13 14 |
# File 'lib/pith/config_provider.rb', line 10 def initialize(project) @project = project @last_load_mtime = :never sync end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
16 17 18 |
# File 'lib/pith/config_provider.rb', line 16 def config @config end |
Instance Method Details
#sync ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/pith/config_provider.rb', line 18 def sync config_mtime = config_file.mtime rescue nil unless config_mtime == @last_load_mtime @last_load_mtime = config_mtime @project.logger.debug "loading config" @config = Pith::Config.load(config_file) notify_observers end end |