Class: GFA::Field::Json
- Inherits:
-
GFA::Field
- Object
- GFA::Field
- GFA::Field::Json
- Defined in:
- lib/gfa/field/json.rb
Constant Summary collapse
- CODE =
:J
- REGEX =
/[ !-~]+/
- NATIVE_FUN =
:to_s
Constants inherited from GFA::Field
Instance Attribute Summary
Attributes inherited from GFA::Field
Instance Method Summary collapse
- #equivalent?(field) ⇒ Boolean
-
#initialize(f) ⇒ Json
constructor
A new instance of Json.
Methods inherited from GFA::Field
#!~, #==, [], #code, code_class, #eql?, #hash, name_class, #native_fun, #regex, #to_native, #to_s, #type, #~
Constructor Details
#initialize(f) ⇒ Json
Returns a new instance of Json.
6 7 8 9 |
# File 'lib/gfa/field/json.rb', line 6 def initialize(f) GFA.assert_format(f, regex, "Bad #{type}") @value = f end |
Instance Method Details
#equivalent?(field) ⇒ Boolean
11 12 13 14 15 16 17 |
# File 'lib/gfa/field/json.rb', line 11 def equivalent?(field) # TODO # We should parse the contents when comparing two GFA::Field::Json to # evaluate equivalencies such as 'J:{ "a" : 1 }' ~ 'J:{"a":1}' (spaces) # or 'J:{"a":1,"b":2}' ~ 'J:{"b":2,"a":1}' (element order) super end |