Class: Ruboty::Gominohi::YAML
- Inherits:
-
Object
- Object
- Ruboty::Gominohi::YAML
- Defined in:
- lib/ruboty/gominohi/yaml.rb
Constant Summary collapse
- YAML_DIRS =
[ Dir.pwd, File.join(File.dirname(File.(__FILE__)), '..', '..', '..') ].freeze
- YAML_FILE =
'.gominohi.yml'.freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize ⇒ YAML
constructor
A new instance of YAML.
Constructor Details
#initialize ⇒ YAML
Returns a new instance of YAML.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ruboty/gominohi/yaml.rb', line 15 def initialize YAML_DIRS.each do |dir| filename = File.join(dir, YAML_FILE) if File.exists?(filename) @data = deep_symbolize_keys(::YAML.load(File.read(filename))) break end end raise "#{YAML_FILE} is not found" if @data.nil? yaml_version = parse_and_truncate_patch_version(@data[:version]) gominohi_version = parse_and_truncate_patch_version(::Ruboty::Gominohi::VERSION) raise 'version of `.gominohi.yml` is invalid' unless yaml_version == gominohi_version end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
13 14 15 |
# File 'lib/ruboty/gominohi/yaml.rb', line 13 def data @data end |