Class: GFA::Field::String
- Inherits:
-
GFA::Field
- Object
- GFA::Field
- GFA::Field::String
- Defined in:
- lib/gfa/field/string.rb
Constant Summary collapse
- CODE =
:Z
- REGEX =
/[ !-~]+/
- NATIVE_FUN =
:to_s
Constants inherited from GFA::Field
Instance Attribute Summary
Attributes inherited from GFA::Field
Instance Method Summary collapse
-
#initialize(f) ⇒ String
constructor
A new instance of String.
- #to_f ⇒ Object
- #to_i(base = 10) ⇒ Object
Methods inherited from GFA::Field
#!~, #==, [], #code, code_class, #eql?, #equivalent?, #hash, name_class, #native_fun, #regex, #to_native, #to_s, #type, #~
Constructor Details
#initialize(f) ⇒ String
Returns a new instance of String.
14 15 16 17 |
# File 'lib/gfa/field/string.rb', line 14 def initialize(f) GFA.assert_format(f, regex, "Bad #{type}") @value = f end |
Instance Method Details
#to_f ⇒ Object
6 7 8 |
# File 'lib/gfa/field/string.rb', line 6 def to_f value.to_f end |
#to_i(base = 10) ⇒ Object
10 11 12 |
# File 'lib/gfa/field/string.rb', line 10 def to_i(base = 10) value.to_i(base) end |