Class: L43Rmap::Runtime
- Inherits:
-
Object
- Object
- L43Rmap::Runtime
- Defined in:
- lib/l43_rmap/runtime.rb,
lib/l43_rmap/runtime/line_time.rb
Defined Under Namespace
Classes: LineTime
Constant Summary collapse
- DefaultDecRandomMax =
10_000
Instance Attribute Summary collapse
-
#chunks ⇒ Object
readonly
Returns the value of attribute chunks.
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#input_stream ⇒ Object
readonly
Returns the value of attribute input_stream.
-
#output_stream ⇒ Object
readonly
Returns the value of attribute output_stream.
-
#rand ⇒ Object
readonly
Returns the value of attribute rand.
-
#terminated ⇒ Object
readonly
Returns the value of attribute terminated.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #image ⇒ Object
- #random_hex ⇒ Object
- #random_rd ⇒ Object
- #run(input, output) ⇒ Object
- #terminate! ⇒ Object
- #timestamp(base, mult: 1_000, now: nil) ⇒ Object
Instance Attribute Details
#chunks ⇒ Object (readonly)
Returns the value of attribute chunks.
8 9 10 |
# File 'lib/l43_rmap/runtime.rb', line 8 def chunks @chunks end |
#current ⇒ Object (readonly)
Returns the value of attribute current.
8 9 10 |
# File 'lib/l43_rmap/runtime.rb', line 8 def current @current end |
#input_stream ⇒ Object (readonly)
Returns the value of attribute input_stream.
8 9 10 |
# File 'lib/l43_rmap/runtime.rb', line 8 def input_stream @input_stream end |
#output_stream ⇒ Object (readonly)
Returns the value of attribute output_stream.
8 9 10 |
# File 'lib/l43_rmap/runtime.rb', line 8 def output_stream @output_stream end |
#rand ⇒ Object (readonly)
Returns the value of attribute rand.
8 9 10 |
# File 'lib/l43_rmap/runtime.rb', line 8 def rand @rand end |
#terminated ⇒ Object (readonly)
Returns the value of attribute terminated.
8 9 10 |
# File 'lib/l43_rmap/runtime.rb', line 8 def terminated @terminated end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
8 9 10 |
# File 'lib/l43_rmap/runtime.rb', line 8 def time @time end |
Instance Method Details
#image ⇒ Object
27 |
# File 'lib/l43_rmap/runtime.rb', line 27 def image = chunks.map(&:image).join("\n") |
#random_hex ⇒ Object
23 |
# File 'lib/l43_rmap/runtime.rb', line 23 def random_hex = @__randomhex__ ||= SecureRandom.hex |
#random_rd ⇒ Object
25 |
# File 'lib/l43_rmap/runtime.rb', line 25 def random_rd = @__randomrd__ ||= (format "%04d", SecureRandom.random_number(DefaultDecRandomMax)) |
#run(input, output) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/l43_rmap/runtime.rb', line 12 def run(input, output) @output_stream = make_output_stream(output) @input_stream = make_input_stream(input) # @rand = SecureRandom.random_number @time = Time.now # p(time1: time.to_f) execute! rescue EOFError end |
#terminate! ⇒ Object
29 |
# File 'lib/l43_rmap/runtime.rb', line 29 def terminate! = @terminated = true |
#timestamp(base, mult: 1_000, now: nil) ⇒ Object
31 32 33 34 35 |
# File 'lib/l43_rmap/runtime.rb', line 31 def (base, mult: 1_000, now: nil) # p(time2: time.to_f) now ||= time (now.to_f * mult).to_i.to_s(base) end |