Class: Construqt::Flavour::Ciscian::Result::Lines::Line
- Inherits:
-
Object
- Object
- Construqt::Flavour::Ciscian::Result::Lines::Line
- Defined in:
- lib/construqt/flavour/ciscian/ciscian.rb
Instance Attribute Summary collapse
-
#nr ⇒ Object
readonly
Returns the value of attribute nr.
-
#to_s ⇒ Object
readonly
Returns the value of attribute to_s.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(str, nr) ⇒ Line
constructor
A new instance of Line.
Constructor Details
#initialize(str, nr) ⇒ Line
Returns a new instance of Line.
33 34 35 36 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 33 def initialize(str, nr) @to_s = str @nr = nr end |
Instance Attribute Details
#nr ⇒ Object (readonly)
Returns the value of attribute nr.
32 33 34 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 32 def nr @nr end |
#to_s ⇒ Object (readonly)
Returns the value of attribute to_s.
32 33 34 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 32 def to_s @to_s end |
Instance Method Details
#<=>(other) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/construqt/flavour/ciscian/ciscian.rb', line 38 def <=>(other) a = self.to_s b = other.to_s match_a=/^(.*[^\d])(\d+)$/.match(a)||[nil,a,1] match_b=/^(.*[^\d])(\d+)$/.match(b)||[nil,b,1] #puts match_a, match_b, a, b ret = match_a[1]<=>match_b[1] ret = match_a[2].to_i<=>match_b[2].to_i if ret==0 ret end |