Class: Blackcal::Builder
- Inherits:
-
Object
- Object
- Blackcal::Builder
- Defined in:
- lib/blackcal/builder.rb
Overview
Builder provides a DSL for schedule options
Class Method Summary collapse
-
.dsl(&block) ⇒ Builder
Enables a DSL for building schedule options.
Instance Method Summary collapse
- #days(*days) ⇒ Object
- #finish_hour_of_day(finish_hour_of_day) ⇒ Object
- #finish_time(finish_time) ⇒ Object
-
#initialize ⇒ Builder
constructor
Returns a new instance of Builder.
- #months(*months) ⇒ Object
- #start_time(start_time) ⇒ Object
- #start_time_of_day(start_time_of_day) ⇒ Object
-
#to_h ⇒ Hash
The builder represented as a hash.
- #weekdays(*weekdays) ⇒ Object
- #weeks_of_month(*weeks_of_month) ⇒ Object
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder
18 19 20 |
# File 'lib/blackcal/builder.rb', line 18 def initialize @data = {} end |
Class Method Details
.dsl(&block) ⇒ Builder
Enables a DSL for building schedule options
13 14 15 |
# File 'lib/blackcal/builder.rb', line 13 def self.dsl(&block) new.tap { |b| b.instance_eval(&block) } end |
Instance Method Details
#days(*days) ⇒ Object
58 59 60 |
# File 'lib/blackcal/builder.rb', line 58 def days(*days) @data[:days] = flat_array(days) end |
#finish_hour_of_day(finish_hour_of_day) ⇒ Object
38 39 40 |
# File 'lib/blackcal/builder.rb', line 38 def finish_hour_of_day(finish_hour_of_day) @data[:finish_hour_of_day] = finish_hour_of_day end |
#finish_time(finish_time) ⇒ Object
28 29 30 |
# File 'lib/blackcal/builder.rb', line 28 def finish_time(finish_time) @data[:finish_time] = finish_time end |
#months(*months) ⇒ Object
43 44 45 |
# File 'lib/blackcal/builder.rb', line 43 def months(*months) @data[:months] = flat_array(months) end |
#start_time(start_time) ⇒ Object
23 24 25 |
# File 'lib/blackcal/builder.rb', line 23 def start_time(start_time) @data[:start_time] = start_time end |
#start_time_of_day(start_time_of_day) ⇒ Object
33 34 35 |
# File 'lib/blackcal/builder.rb', line 33 def start_time_of_day(start_time_of_day) @data[:start_time_of_day] = start_time_of_day end |
#to_h ⇒ Hash
The builder represented as a hash
64 65 66 |
# File 'lib/blackcal/builder.rb', line 64 def to_h @data end |
#weekdays(*weekdays) ⇒ Object
48 49 50 |
# File 'lib/blackcal/builder.rb', line 48 def weekdays(*weekdays) @data[:weekdays] = flat_array(weekdays) end |
#weeks_of_month(*weeks_of_month) ⇒ Object
53 54 55 |
# File 'lib/blackcal/builder.rb', line 53 def weeks_of_month(*weeks_of_month) @data[:weeks_of_month] = flat_array(weeks_of_month) end |