Class: RecurringTodos::MonthlyRecurringTodosBuilder
Instance Attribute Summary collapse
#mapped_attributes, #pattern
Instance Method Summary
collapse
#attributes, #build, #errors, #filter_attributes, #filter_generic_attributes, #get_selector, #map, #save, #save_collection, #save_context, #save_project, #save_recurring_todo, #save_tags, #saved_recurring_todo, #tag_list_or_empty_string, #update
Constructor Details
Returns a new instance of MonthlyRecurringTodosBuilder.
5
6
7
|
# File 'app/models/recurring_todos/monthly_recurring_todos_builder.rb', line 5
def initialize(user, attributes)
super(user, attributes, MonthlyRecurrencePattern)
end
|
Instance Attribute Details
#recurring_todo ⇒ Object
Returns the value of attribute recurring_todo.
3
4
5
|
# File 'app/models/recurring_todos/monthly_recurring_todos_builder.rb', line 3
def recurring_todo
@recurring_todo
end
|
Instance Method Details
#attributes_to_filter ⇒ Object
9
10
11
12
13
14
|
# File 'app/models/recurring_todos/monthly_recurring_todos_builder.rb', line 9
def attributes_to_filter
%w{
monthly_selector monthly_every_x_day monthly_every_x_month
monthly_every_x_month2 monthly_every_xth_day monthly_day_of_week
}
end
|
#get_every_other2 ⇒ Object
31
32
33
|
# File 'app/models/recurring_todos/monthly_recurring_todos_builder.rb', line 31
def get_every_other2
get_recurrence_selector == 0 ? 'monthly_every_x_month' : 'monthly_every_x_month2'
end
|
#get_recurrence_selector ⇒ Object
27
28
29
|
# File 'app/models/recurring_todos/monthly_recurring_todos_builder.rb', line 27
def get_recurrence_selector
@selector == 'monthly_every_x_day' ? 0 : 1
end
|
#map_attributes(mapping) ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'app/models/recurring_todos/monthly_recurring_todos_builder.rb', line 16
def map_attributes(mapping)
mapping = map(mapping, :every_other1, 'monthly_every_x_day')
mapping = map(mapping, :every_other3, 'monthly_every_xth_day')
mapping = map(mapping, :every_count, 'monthly_day_of_week')
mapping.set(:recurrence_selector, get_recurrence_selector)
mapping.set(:every_other2, mapping.get(get_every_other2))
mapping.except('monthly_every_x_month').except('monthly_every_x_month2')
end
|
#selector_key ⇒ Object
35
36
37
|
# File 'app/models/recurring_todos/monthly_recurring_todos_builder.rb', line 35
def selector_key
:monthly_selector
end
|
#valid_selector?(selector) ⇒ Boolean
39
40
41
|
# File 'app/models/recurring_todos/monthly_recurring_todos_builder.rb', line 39
def valid_selector?(selector)
%w{monthly_every_x_day monthly_every_xth_day}.include?(selector)
end
|