Class: RubyApp::Elements::Calendars::Base::BaseMonth

Inherits:
RubyApp::Element show all
Defined in:
lib/ruby_app/elements/calendars/base/base_month.rb

Direct Known Subclasses

Month

Defined Under Namespace

Classes: ChangedEvent, MovedEvent

Instance Attribute Summary collapse

Attributes inherited from RubyApp::Element

#attributes

Instance Method Summary collapse

Methods inherited from RubyApp::Element

#element_id, get_element

Methods included from Mixins::ConfigureMixin

#configure

Methods included from Mixins::TranslateMixin

#localize, #translate

Methods included from Mixins::TemplateMixin

#exclude_parent_template, #exclude_parent_template?, #get_templates, #template_name, #template_path

Methods included from Mixins::RenderMixin

#clear_content_for, #content_for, #render, #rendered?

Constructor Details

#initializeBaseMonth

Returns a new instance of BaseMonth.



54
55
56
57
58
# File 'lib/ruby_app/elements/calendars/base/base_month.rb', line 54

def initialize
  super
  @display = Date.today
  @value = @display
end

Instance Attribute Details

#displayObject

Returns the value of attribute display.



50
51
52
# File 'lib/ruby_app/elements/calendars/base/base_month.rb', line 50

def display
  @display
end

#valueObject

Returns the value of attribute value.



50
51
52
# File 'lib/ruby_app/elements/calendars/base/base_month.rb', line 50

def value
  @value
end

Instance Method Details

#display_first_dateObject



60
61
62
63
# File 'lib/ruby_app/elements/calendars/base/base_month.rb', line 60

def display_first_date
  first_of_month = @display - (@display.day - 1)
  first_of_month - first_of_month.wday
end

#display_last_dateObject



65
66
67
68
69
# File 'lib/ruby_app/elements/calendars/base/base_month.rb', line 65

def display_last_date
  next_month = @display >> 1
  last_of_month = next_month - next_month.day
  last_of_month + (6 - last_of_month.wday)
end