Sha256: 9bd56dc5801a6015e047b3b9fa5fd7148b2ef81b6187f2b69635c8f019203b7a
Contents?: true
Size: 1017 Bytes
Versions: 1
Compression:
Stored size: 1017 Bytes
Contents
module Linguist module Models class Resource attr_reader :locale, :format, :link # @param client [Linguist::Client] passed through client instance # @param locale [String] String that represents a locale in ISO 2 format, e.g. 'en', 'de' # @param format [String] Extension of the file format, e.g. 'en', 'de' # @param link [String] Link to the resource, e.g. 'http://lvh.me:3000/api/v1/projects/project-1/resources/de.properties' def initialize(client, locale, format, link) @client = client @link = link @locale = locale @format = format end # Downloads the resource and creates the new resource file. Overrides existing files. # @param dir [String] The directory where to store the file, e.g. '/Users/heli' would create a file '/Users/heli/en.yml' def download(dir) response = @client.get(link) File.open(dir + "/#{locale}#{format}", 'w+') { |f| f.write(response) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
linguist_ruby-0.0.2 | lib/linguist/models/resource.rb |