Sha256: 132b7b28a257bad9c208b915aa098501e079b2d4aa848dc32ff8570c40002ccd

Contents?: true

Size: 444 Bytes

Versions: 7

Compression:

Stored size: 444 Bytes

Contents

require 'idiom/base'

module Idiom #:nodoc:
  # Usage: 
  #   Translator::Yaml.new().copy
  #
  class Yaml < Base
    def extension
      "yml"
    end
    
    def parse(path)
      YAML.load_file(path)
    end
    
    def format(key, value)
      "#{key}: #{value}"
    end
    
    def key_and_value_from_line(line)
      if line =~ /^([^\:]+):(.*)/
        return $1, $2.strip
      else
        return nil, nil
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
idiom-0.3.0 lib/idiom/yaml.rb
idiom-0.2.2 lib/idiom/yaml.rb
idiom-0.2.0 lib/idiom/yaml.rb
idiom-0.1.0 lib/idiom/yaml.rb
idiom-0.0.8 lib/idiom/yaml.rb
idiom-0.0.7 lib/idiom/yaml.rb
idiom-0.0.6 lib/idiom/yaml.rb