Class: Ginbin::ItemsFromConfig
- Inherits:
-
Object
- Object
- Ginbin::ItemsFromConfig
- Includes:
- Enumerable
- Defined in:
- lib/ginbin/items_from_config.rb
Instance Method Summary collapse
Instance Method Details
#at_home? ⇒ Boolean
25 26 27 |
# File 'lib/ginbin/items_from_config.rb', line 25 def at_home? Dir.getwd == Dir.home end |
#each ⇒ Object
7 8 9 10 11 |
# File 'lib/ginbin/items_from_config.rb', line 7 def each (local_items + home_items).each do |item| yield item end end |
#home_items ⇒ Object
19 20 21 22 23 |
# File 'lib/ginbin/items_from_config.rb', line 19 def home_items return [] unless File.exist? File.join(Dir.home, '.ginbin.yml') YAML.load_file(File.join(Dir.home, '.ginbin.yml'))["commands"] end |
#local_items ⇒ Object
13 14 15 16 17 |
# File 'lib/ginbin/items_from_config.rb', line 13 def local_items return [] if at_home? return [] unless File.exist? '.ginbin.yml' YAML.load_file('.ginbin.yml')["commands"] end |