Class: TwitterCldr::Resources::Requirements::IcuRequirement
- Inherits:
-
Object
- Object
- TwitterCldr::Resources::Requirements::IcuRequirement
- Defined in:
- lib/twitter_cldr/resources/requirements/icu_requirement.rb
Overview
This requirement makes use of the JarClassLoader package (github.com/kamranzafar/JCL) to load ICU in an isolated environment to keep different versions of the library separate. If ICU versions are not kept separate, the one that’s first on the classpath wins, which can be surprising if you’re not expecting it. Oh, and it can break all the tests.
Constant Summary collapse
- POM_FILE =
File.join(TwitterCldr::VENDOR_DIR, 'maven', 'pom.xml').freeze
Instance Attribute Summary collapse
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #get_class(name) ⇒ Object
-
#initialize(version) ⇒ IcuRequirement
constructor
A new instance of IcuRequirement.
- #prepare ⇒ Object
Constructor Details
#initialize(version) ⇒ IcuRequirement
Returns a new instance of IcuRequirement.
22 23 24 |
# File 'lib/twitter_cldr/resources/requirements/icu_requirement.rb', line 22 def initialize(version) @version = version end |
Instance Attribute Details
#version ⇒ Object (readonly)
Returns the value of attribute version.
20 21 22 |
# File 'lib/twitter_cldr/resources/requirements/icu_requirement.rb', line 20 def version @version end |
Instance Method Details
#get_class(name) ⇒ Object
37 38 39 |
# File 'lib/twitter_cldr/resources/requirements/icu_requirement.rb', line 37 def get_class(name) class_loader.load_class(name).ruby_class end |
#prepare ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/twitter_cldr/resources/requirements/icu_requirement.rb', line 26 def prepare pom.add_dependency('com.ibm.icu', 'icu4j', version) pom.add_dependency('org.xeustechnologies', 'jcl-core', '2.7') pom.install pom.require_jar('org.xeustechnologies', 'jcl-core') java_import 'org.xeustechnologies.jcl.JarClassLoader' class_loader.add(pom.get('com.ibm.icu', 'icu4j').path) end |