Class: Courtier::Properties
- Inherits:
-
Object
- Object
- Courtier::Properties
- Defined in:
- lib/courtier/properties.rb
Overview
TODO:
Lookup project root directory.
Currently properties derive from a project’s .ruby file. This will be expanded upon in future version to allow additional customization.
Constant Summary collapse
- DATA_FILE =
'.ruby'
Instance Method Summary collapse
- #import_gemspec ⇒ Object private
-
#initialize ⇒ Properties
constructor
A new instance of Properties.
- #method_missing(s) ⇒ Object
Constructor Details
#initialize ⇒ Properties
Returns a new instance of Properties.
19 20 21 22 23 24 25 |
# File 'lib/courtier/properties.rb', line 19 def initialize @data = {} if file = Dir[DATA_FILE].first @data.update(YAML.load_file(file)) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(s) ⇒ Object
30 31 32 |
# File 'lib/courtier/properties.rb', line 30 def method_missing(s) @data[s.to_s] end |
Instance Method Details
#import_gemspec ⇒ Object (private)
TODO:
Support gemspec as properties source ?
37 38 39 40 |
# File 'lib/courtier/properties.rb', line 37 def import_gemspec file = Dir['{*,,pkg/*}.gemspec'].first # ... end |