Class: Fontist::StyleVersion
- Inherits:
-
Object
- Object
- Fontist::StyleVersion
- Defined in:
- lib/fontist/style_version.rb
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #default_value ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(text) ⇒ StyleVersion
constructor
A new instance of StyleVersion.
- #numbers ⇒ Object
- #string_version ⇒ Object
- #to_s ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(text) ⇒ StyleVersion
Returns a new instance of StyleVersion.
3 4 5 |
# File 'lib/fontist/style_version.rb', line 3 def initialize(text) @text = text end |
Instance Method Details
#<=>(other) ⇒ Object
27 28 29 |
# File 'lib/fontist/style_version.rb', line 27 def <=>(other) value <=> other.value end |
#==(other) ⇒ Object
31 32 33 |
# File 'lib/fontist/style_version.rb', line 31 def ==(other) value == other.value end |
#default_value ⇒ Object
23 24 25 |
# File 'lib/fontist/style_version.rb', line 23 def default_value ["0"] end |
#eql?(other) ⇒ Boolean
35 36 37 |
# File 'lib/fontist/style_version.rb', line 35 def eql?(other) value.eql?(other.value) end |
#hash ⇒ Object
39 40 41 |
# File 'lib/fontist/style_version.rb', line 39 def hash value.hash end |
#numbers ⇒ Object
15 16 17 |
# File 'lib/fontist/style_version.rb', line 15 def numbers string_version&.split(".")&.map(&:strip) end |
#string_version ⇒ Object
19 20 21 |
# File 'lib/fontist/style_version.rb', line 19 def string_version @text&.split(";")&.first end |
#to_s ⇒ Object
7 8 9 |
# File 'lib/fontist/style_version.rb', line 7 def to_s value.join(" . ") end |
#value ⇒ Object
11 12 13 |
# File 'lib/fontist/style_version.rb', line 11 def value @value ||= numbers || default_value end |