Class: Recipe

Inherits:
Object
  • Object
show all
Defined in:
lib/kittyverse/recipes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ Recipe

Returns a new instance of Recipe.



11
12
13
# File 'lib/kittyverse/recipes.rb', line 11

def initialize( **kwargs )
  update( kwargs )
end

Instance Attribute Details

#limitObject

use date_start -why? why not?



5
6
7
# File 'lib/kittyverse/recipes.rb', line 5

def limit
  @limit
end

#time_endObject

use date_start -why? why not?



5
6
7
# File 'lib/kittyverse/recipes.rb', line 5

def time_end
  @time_end
end

#time_startObject

use date_start -why? why not?



5
6
7
# File 'lib/kittyverse/recipes.rb', line 5

def time_start
  @time_start
end

#traitsObject

use date_start -why? why not?



5
6
7
# File 'lib/kittyverse/recipes.rb', line 5

def traits
  @traits
end

#variantsObject

use date_start -why? why not?



5
6
7
# File 'lib/kittyverse/recipes.rb', line 5

def variants
  @variants
end

Instance Method Details

#time?Boolean

is recipe time windowed? true/false

Returns:

  • (Boolean)


23
# File 'lib/kittyverse/recipes.rb', line 23

def time?() @time_start && @time_end; end

#time_daysObject



25
# File 'lib/kittyverse/recipes.rb', line 25

def time_days() (@time_end.jd - @time_start.jd) + 1; end

#update(**kwargs) ⇒ Object



15
16
17
18
19
20
# File 'lib/kittyverse/recipes.rb', line 15

def update( **kwargs )
  kwargs.each do |name,value|
    send( "#{name}=", value ) ## use "regular" plain/classic attribute setter
  end
  self   ## return self for chaining
end