Sha256: 9c5773b674a7679605b48dc2facd4d43426ec3321266df2a68028326000ed9c0

Contents?: true

Size: 501 Bytes

Versions: 4

Compression:

Stored size: 501 Bytes

Contents

require 'idiom/base'

module Idiom #:nodoc:
  # Usage: 
  #   Translator::Yaml.new().copy
  #
  class Yaml < Base
    def destination_path(lang)
      source
    end
    
    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

4 entries across 4 versions & 1 rubygems

Version Path
idiom-0.4.2 lib/idiom/yaml.rb
idiom-0.4.1 lib/idiom/yaml.rb
idiom-0.3.1 lib/idiom/yaml.rb
idiom-0.4.0 lib/idiom/yaml.rb