Module: Jeweler::VersionHelper::YamlExtension
- Defined in:
- lib/jeweler/version_helper.rb
Instance Method Summary collapse
- #parse_yaml ⇒ Object
- #path ⇒ Object
- #read_yaml ⇒ Object
- #refresh ⇒ Object
- #to_hash ⇒ Object
- #write ⇒ Object
Instance Method Details
#parse_yaml ⇒ Object
25 26 27 28 |
# File 'lib/jeweler/version_helper.rb', line 25 def parse_yaml yaml = read_yaml update_to(yaml['version'] || yaml[:version]) end |
#path ⇒ Object
38 39 40 |
# File 'lib/jeweler/version_helper.rb', line 38 def path yaml_path end |
#read_yaml ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/jeweler/version_helper.rb', line 30 def read_yaml if File.exists?(yaml_path) YAML.load_file(yaml_path) else raise VersionYmlError, "#{yaml_path} does not exist!" end end |
#refresh ⇒ Object
21 22 23 |
# File 'lib/jeweler/version_helper.rb', line 21 def refresh parse_yaml end |
#to_hash ⇒ Object
15 16 17 18 19 |
# File 'lib/jeweler/version_helper.rb', line 15 def to_hash { :version => version } end |
#write ⇒ Object
9 10 11 12 13 |
# File 'lib/jeweler/version_helper.rb', line 9 def write File.open(yaml_path, 'w+') do |f| YAML.dump(self.to_hash, f) end end |