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.
-
#today ⇒ Object
Returns the value of attribute today.
-
#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(today = Date.today, display = nil, value = nil) ⇒ BaseMonth
constructor
A new instance of BaseMonth.
Methods inherited from RubyApp::Element
Methods included from Mixins::ConfigurationMixin
Methods included from Mixins::TranslateMixin
Methods included from Mixins::TemplateMixin
#exclude_parent_template, #exclude_parent_template?, #get_cache, #get_template, #get_templates, #template_name, #template_path
Methods included from Mixins::RenderMixin
#content_for, #render, #rendered?
Constructor Details
#initialize(today = Date.today, display = nil, value = nil) ⇒ BaseMonth
Returns a new instance of BaseMonth.
54 55 56 57 58 59 |
# File 'lib/ruby_app/elements/calendars/base/base_month.rb', line 54 def initialize(today = Date.today, display = nil, value = nil) super() @today = today @display = display || today @value = 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 |
#today ⇒ Object
Returns the value of attribute today.
50 51 52 |
# File 'lib/ruby_app/elements/calendars/base/base_month.rb', line 50 def today @today 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
61 62 63 64 |
# File 'lib/ruby_app/elements/calendars/base/base_month.rb', line 61 def display_first_date first_of_month = @display - (@display.day - 1) first_of_month - first_of_month.wday end |
#display_last_date ⇒ Object
66 67 68 69 70 |
# File 'lib/ruby_app/elements/calendars/base/base_month.rb', line 66 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 |