Module: Daterange

Extended by:
ActiveSupport::Concern
Defined in:
lib/acts_as_daterange/daterange.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#active_now?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/acts_as_daterange/daterange.rb', line 55

def active_now?
  started? and not ended?
end

#expireObject



45
46
47
48
# File 'lib/acts_as_daterange/daterange.rb', line 45

def expire
  write_attribute(start_column, nil)
  write_attribute(expire_column, Time.now)
end

#expire!Object



50
51
52
53
# File 'lib/acts_as_daterange/daterange.rb', line 50

def expire!
  update_attribute(start_column, nil)
  update_attribute(expire_column, Time.now)
end

#expire_columnObject



37
38
39
# File 'lib/acts_as_daterange/daterange.rb', line 37

def expire_column
  self.class.expire_column
end

#start_columnObject



41
42
43
# File 'lib/acts_as_daterange/daterange.rb', line 41

def start_column
  self.class.start_column
end