Class: RubyApp::Elements::Calendars::Base::BaseMonth
- Inherits:
-
RubyApp::Element
- Object
- RubyApp::Element
- RubyApp::Elements::Calendars::Base::BaseMonth
- Defined in:
- lib/ruby_app/elements/calendars/base/base_month.rb
Direct Known Subclasses
Defined Under Namespace
Classes: ChangedEvent, MovedEvent
Instance Attribute Summary collapse
-
#display ⇒ Object
Returns the value of attribute display.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from RubyApp::Element
Instance Method Summary collapse
- #display_first_date ⇒ Object
- #display_last_date ⇒ Object
-
#initialize ⇒ BaseMonth
constructor
A new instance of BaseMonth.
Methods inherited from RubyApp::Element
Methods included from Mixins::ConfigureMixin
Methods included from Mixins::TranslateMixin
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
#initialize ⇒ BaseMonth
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
#display ⇒ Object
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 |
#value ⇒ Object
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_date ⇒ Object
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_date ⇒ Object
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 |