Class: Wutang::Config
- Inherits:
-
Object
- Object
- Wutang::Config
- Defined in:
- lib/wutang/config.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#config_file ⇒ Object
readonly
Returns the value of attribute config_file.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #parse ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
5 6 7 8 |
# File 'lib/wutang/config.rb', line 5 def initialize @config_file = File.('~/.wutang.yml') parse end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/wutang/config.rb', line 3 def attributes @attributes end |
#config_file ⇒ Object (readonly)
Returns the value of attribute config_file.
3 4 5 |
# File 'lib/wutang/config.rb', line 3 def config_file @config_file end |
Instance Method Details
#parse ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/wutang/config.rb', line 10 def parse if File.world_readable?(config_file) puts "Your config file has world readable permissions" puts "Please run: chmod 640 ~/.wutang.yml" exit 1 elsif File.exists?(config_file) @attributes = YAML.load_file(config_file) else puts "Please create a ~/.wutang.yml with a `path` and `pasphrase`" exit 1 end end |