Class: Nmg::Type::Operation

Inherits:
Base
  • Object
show all
Defined in:
lib/nmg/type/operation.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.generate(count, options = {}, gen = Random.new) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/nmg/type/operation.rb', line 14

def self.generate(count, options = {}, gen = Random.new)
  prep = (options[:prep_min]..options[:prep_max])
  count.times.map do
    new(preparation: gen.rand(prep),
       duration: gen.rand(options[:min]..options[:max]))
  end
end

Instance Method Details

#to_json(options = {}) ⇒ Object



7
8
9
10
11
12
# File 'lib/nmg/type/operation.rb', line 7

def to_json(options = {})
  {
    preparation: preparation,
    duration: duration
  }.to_json(options)
end