Class: Simpler::Reply
- Inherits:
-
String
- Object
- String
- Simpler::Reply
- Defined in:
- lib/simpler/reply.rb
Constant Summary collapse
- ONE_FLOAT_RE =
/] ([\w\.-]+)/o
Instance Method Summary collapse
- #array_cast ⇒ Object
-
#rm_leader ⇒ Object
removes the [1] from the line.
-
#to_sf ⇒ Object
returns a single float.
Instance Method Details
#array_cast ⇒ Object
11 12 13 |
# File 'lib/simpler/reply.rb', line 11 def array_cast self.chomp.split("\n").rm_leader.split(" ") end |
#rm_leader ⇒ Object
removes the [1] from the line
7 8 9 |
# File 'lib/simpler/reply.rb', line 7 def rm_leader gsub(/^\[\d+\] /,'') end |
#to_sf ⇒ Object
returns a single float. Assumes the answer takes the form: ā[1] <Float>nā => Float
16 17 18 |
# File 'lib/simpler/reply.rb', line 16 def to_sf ONE_FLOAT_RE.match(self)[1].to_f end |