Class: Fontist::StyleVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/fontist/style_version.rb

Instance Method Summary collapse

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



23
24
25
# File 'lib/fontist/style_version.rb', line 23

def <=>(other)
  value <=> other.value
end

#==(other) ⇒ Object



27
28
29
# File 'lib/fontist/style_version.rb', line 27

def ==(other)
  value == other.value
end

#default_valueObject



19
20
21
# File 'lib/fontist/style_version.rb', line 19

def default_value
  ["0"]
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/fontist/style_version.rb', line 31

def eql?(other)
  value.eql?(other.value)
end

#hashObject



35
36
37
# File 'lib/fontist/style_version.rb', line 35

def hash
  value.hash
end

#numbersObject



11
12
13
# File 'lib/fontist/style_version.rb', line 11

def numbers
  string_version&.split(".")&.map(&:strip)
end

#string_versionObject



15
16
17
# File 'lib/fontist/style_version.rb', line 15

def string_version
  @text&.split(";")&.first
end

#valueObject



7
8
9
# File 'lib/fontist/style_version.rb', line 7

def value
  @value ||= numbers || default_value
end