Class: TestML::Str
Overview
Instance Attribute Summary
Attributes inherited from Object
Instance Method Summary collapse
- #bool ⇒ Object
-
#initialize(str) ⇒ Str
constructor
A new instance of Str.
- #list ⇒ Object
- #num ⇒ Object
- #str ⇒ Object
Methods inherited from Object
Constructor Details
#initialize(str) ⇒ Str
Returns a new instance of Str.
409 410 411 |
# File 'lib/testml/runtime.rb', line 409 def initialize(str) @value = str.to_s end |
Instance Method Details
#bool ⇒ Object
418 419 420 |
# File 'lib/testml/runtime.rb', line 418 def bool !@value.empty? ? TestML::Constant::True : TestML::Constant::False end |
#list ⇒ Object
421 422 423 |
# File 'lib/testml/runtime.rb', line 421 def list TestML::List.new(@value.split //) end |
#num ⇒ Object
415 416 417 |
# File 'lib/testml/runtime.rb', line 415 def num TestML::Num.new(@value =~ /^-?\d+(?:\.\d+)$/ ? $1.to_i : 0) end |
#str ⇒ Object
412 413 414 |
# File 'lib/testml/runtime.rb', line 412 def str self end |