Class: GFA::Field::String

Inherits:
GFA::Field show all
Defined in:
lib/gfa/field/string.rb

Constant Summary collapse

CODE =
:Z
REGEX =
/[ !-~]+/
NATIVE_FUN =
:to_s

Constants inherited from GFA::Field

CODES, TYPES

Instance Attribute Summary

Attributes inherited from GFA::Field

#value

Instance Method Summary collapse

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_fObject



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