Class: Upcoming::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/upcoming/generators/generator.rb

Direct Known Subclasses

LastDayOfMonthGenerator, WorkingDayGenerator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Generator

Returns a new instance of Generator.



5
6
7
# File 'lib/upcoming/generators/generator.rb', line 5

def initialize(options = {})
  @choose = options.fetch(:choose, :upcoming)
end

Instance Attribute Details

#chooseObject (readonly)

Returns the value of attribute choose.



3
4
5
# File 'lib/upcoming/generators/generator.rb', line 3

def choose
  @choose
end

Instance Method Details

#step(from) ⇒ Object



9
10
11
# File 'lib/upcoming/generators/generator.rb', line 9

def step(from)
  date_range(from).find { |date| valid?(date) }
end