Class: Md2key::Configuration
- Inherits:
-
Object
- Object
- Md2key::Configuration
- Defined in:
- lib/md2key/configuration.rb
Class Method Summary collapse
Instance Method Summary collapse
- #cover_master ⇒ Object
-
#initialize(masters: []) ⇒ Configuration
constructor
A new instance of Configuration.
- #slide_master(level) ⇒ Object
Constructor Details
#initialize(masters: []) ⇒ Configuration
Returns a new instance of Configuration.
39 40 41 42 |
# File 'lib/md2key/configuration.rb', line 39 def initialize(masters: []) @masters = masters validate! end |
Class Method Details
.load ⇒ Object
6 7 8 9 10 11 |
# File 'lib/md2key/configuration.rb', line 6 def load config = {} config.merge!(load_if_available(File.('~/.md2key'))) config.merge!(load_if_available(File.('./.md2key'))) new(symbolize_keys(config)) end |
Instance Method Details
#cover_master ⇒ Object
44 45 46 47 48 49 |
# File 'lib/md2key/configuration.rb', line 44 def cover_master master = @masters.find do |master| master[:cover] end master && master[:name] end |
#slide_master(level) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/md2key/configuration.rb', line 51 def (level) master = @masters.find do |master| master[:template] == level end master && master[:name] end |