Class: Fizzy::ProjectConfig
- Inherits:
-
Object
- Object
- Fizzy::ProjectConfig
- Defined in:
- lib/fizzy/project_config.rb
Constant Summary collapse
- FILENAME =
".fizzy.yml"
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #account ⇒ Object
- #board ⇒ Object
- #boards ⇒ Object
- #found? ⇒ Boolean
-
#initialize(start_dir = Dir.pwd) ⇒ ProjectConfig
constructor
A new instance of ProjectConfig.
- #url ⇒ Object
Constructor Details
#initialize(start_dir = Dir.pwd) ⇒ ProjectConfig
Returns a new instance of ProjectConfig.
9 10 11 12 13 14 15 |
# File 'lib/fizzy/project_config.rb', line 9 def initialize(start_dir = Dir.pwd) @path = find_config(start_dir) data = @path ? YAML.safe_load_file(@path) : {} @data = data.is_a?(Hash) ? data : {} rescue Psych::SyntaxError => e raise Thor::Error, "Bad .fizzy.yml at #{@path}: #{e.}" end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/fizzy/project_config.rb', line 7 def path @path end |
Instance Method Details
#account ⇒ Object
19 |
# File 'lib/fizzy/project_config.rb', line 19 def account = @data["account"] |
#board ⇒ Object
21 |
# File 'lib/fizzy/project_config.rb', line 21 def board = @data["board"] |
#boards ⇒ Object
25 |
# File 'lib/fizzy/project_config.rb', line 25 def boards = @data["boards"] || {} |
#found? ⇒ Boolean
17 |
# File 'lib/fizzy/project_config.rb', line 17 def found? = !@path.nil? |
#url ⇒ Object
23 |
# File 'lib/fizzy/project_config.rb', line 23 def url = @data["url"] |