Class: TwitterCldr::Resources::Requirements::UnicodeRequirement
- Inherits:
-
Object
- Object
- TwitterCldr::Resources::Requirements::UnicodeRequirement
- Defined in:
- lib/twitter_cldr/resources/requirements/unicode_requirement.rb
Direct Known Subclasses
Constant Summary collapse
- UNICODE_URL =
"ftp://ftp.unicode.org/Public/%{version}".freeze
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(version, files) ⇒ UnicodeRequirement
constructor
A new instance of UnicodeRequirement.
- #prepare ⇒ Object
- #source_path_for(file) ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(version, files) ⇒ UnicodeRequirement
Returns a new instance of UnicodeRequirement.
18 19 20 21 |
# File 'lib/twitter_cldr/resources/requirements/unicode_requirement.rb', line 18 def initialize(version, files) @version = version @files = files end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
16 17 18 |
# File 'lib/twitter_cldr/resources/requirements/unicode_requirement.rb', line 16 def files @files end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
16 17 18 |
# File 'lib/twitter_cldr/resources/requirements/unicode_requirement.rb', line 16 def version @version end |
Instance Method Details
#prepare ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/twitter_cldr/resources/requirements/unicode_requirement.rb', line 23 def prepare files.each do |file| unless File.file?(source_path_for(file)) STDOUT.write("Downloading #{file} from unicode v#{version}... ") download(file) puts 'done' end puts "Using #{file} from unicode v#{version}" end end |
#source_path_for(file) ⇒ Object
35 36 37 |
# File 'lib/twitter_cldr/resources/requirements/unicode_requirement.rb', line 35 def source_path_for(file) File.join(TwitterCldr::VENDOR_DIR, "unicode_v#{version}", file) end |
#url ⇒ Object
39 40 41 |
# File 'lib/twitter_cldr/resources/requirements/unicode_requirement.rb', line 39 def url UNICODE_URL end |