Class: Version::Tag
Constant Summary collapse
{}
Instance Attribute Summary collapse
-
#descr ⇒ Object
Returns the value of attribute descr.
-
#name ⇒ Object
Returns the value of attribute name.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#rank ⇒ Object
Returns the value of attribute rank.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(name, descr, rank, offset) ⇒ Tag
constructor
A new instance of Tag.
- #pretty_string ⇒ Object
Constructor Details
#initialize(name, descr, rank, offset) ⇒ Tag
Returns a new instance of Tag.
215 216 217 |
# File 'lib/version.rb', line 215 def initialize ( name, descr, rank, offset ) @name, @descr, @rank, @offset = name, descr, rank, offset end |
Instance Attribute Details
#descr ⇒ Object
Returns the value of attribute descr.
213 214 215 |
# File 'lib/version.rb', line 213 def descr @descr end |
#name ⇒ Object
Returns the value of attribute name.
213 214 215 |
# File 'lib/version.rb', line 213 def name @name end |
#offset ⇒ Object
Returns the value of attribute offset.
213 214 215 |
# File 'lib/version.rb', line 213 def offset @offset end |
#rank ⇒ Object
Returns the value of attribute rank.
213 214 215 |
# File 'lib/version.rb', line 213 def rank @rank end |
Class Method Details
.[](name, offset) ⇒ Object
231 232 233 234 235 |
# File 'lib/version.rb', line 231 def [] ( name, offset ) f = @@tags[name] raise ArgumentError, "Unknown tag ``#{name}''" if f.nil? f[offset] end |
Instance Method Details
#<=>(other) ⇒ Object
223 224 225 226 227 |
# File 'lib/version.rb', line 223 def <=> ( other ) cmp = @rank <=> other.rank return cmp unless cmp.zero? @offset <=> other.offset end |
#pretty_string ⇒ Object
219 220 221 |
# File 'lib/version.rb', line 219 def pretty_string (offset.zero?)? descr : "#{descr} #{offset}" end |