Module: Slab::DateExt

Defined in:
lib/slab/date.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/slab/date.rb', line 4

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#end_of_month?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/slab/date.rb', line 18

def end_of_month?
  self.month != self.advance(:days => 1).month
end

#on_end_of_month(&block) ⇒ Object



22
23
24
25
26
# File 'lib/slab/date.rb', line 22

def on_end_of_month(&block)
  if end_of_month?
    yield(self)
  end
end