ActAsTimeAsBoolean

Build Status Gem Version Code Climate Dependency Status Coverage Status

Add time_as_boolean feature to your ruby classes

Installation

Ruby 1.9.3+, 2+

gem 'act_as_time_as_boolean'

Ruby 1.9.2

gem 'act_as_time_as_boolean', '~> 0.4.0'

Usage

class Item < ActiveRecord::Base
  include ActAsTimeAsBoolean

  attr_accessor :active_at

  time_as_boolean :active, opposite: :inactive
end

item = Item.new

item.active?
#=> false

item.inactive?
#=> true

item.active = true

item.active?
#=> true

item.inactive?
#=> false

Item.active
#=>  #<ActiveRecord::Relation [...]>

Item.inactive
#=>  #<ActiveRecord::Relation [...]>

Contributing

Contributors and CONTRIBUTING

Licence

Released under the MIT License. See the LICENSE file for further details.