Class: GFA::Field::SigInt
- Inherits:
-
GFA::Field
- Object
- GFA::Field
- GFA::Field::SigInt
- Defined in:
- lib/gfa/field/sigint.rb
Constant Summary collapse
- CODE =
:i
- REGEX =
/[-+]?[0-9]+/
- NATIVE_FUN =
:to_i
Constants inherited from GFA::Field
Instance Attribute Summary
Attributes inherited from GFA::Field
Instance Method Summary collapse
- #equivalent?(field) ⇒ Boolean
-
#initialize(f) ⇒ SigInt
constructor
A new instance of SigInt.
- #to_i ⇒ Object
Methods inherited from GFA::Field
#!~, #==, [], #code, code_class, #eql?, #hash, name_class, #native_fun, #regex, #to_native, #to_s, #type, #~
Constructor Details
#initialize(f) ⇒ SigInt
Returns a new instance of SigInt.
6 7 8 9 |
# File 'lib/gfa/field/sigint.rb', line 6 def initialize(f) GFA.assert_format(f, regex, "Bad #{type}") @value = f.to_i end |
Instance Method Details
#equivalent?(field) ⇒ Boolean
15 16 17 18 19 20 21 |
# File 'lib/gfa/field/sigint.rb', line 15 def equivalent?(field) if field.is_a?(GFA::Field::NumArray) return field.size == 1 && field.first.to_i == value end super end |
#to_i ⇒ Object
11 12 13 |
# File 'lib/gfa/field/sigint.rb', line 11 def to_i value end |