Class: Obo::Stanza
- Inherits:
-
Object
- Object
- Obo::Stanza
- Defined in:
- lib/obo/ontology.rb
Instance Method Summary collapse
-
#cast(val) ⇒ Object
returns the value cast based on rules in first xref no casting performed if there is no xref.
- #cast_method ⇒ Object
Instance Method Details
#cast(val) ⇒ Object
returns the value cast based on rules in first xref no casting performed if there is no xref
27 28 29 |
# File 'lib/obo/ontology.rb', line 27 def cast(val) @cast_method ? val.send(@cast_method) : val end |
#cast_method ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/obo/ontology.rb', line 6 def cast_method xref = @tagvalues['xref'].first @cast_method = if xref.nil? || (@cast_method == false) false else if @cast_method @cast_method else case xref[/value-type:xsd\\:([^\s]+) /, 1] when 'float' ; :to_f when 'int' ; :to_i when 'string' ; :to_s else ; false end end end end |