Add time_as_boolean feature to your ruby classes
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
CONTRIBUTING.md
Gemfile
LICENSE.md
README.md
Rakefile
act_as_time_as_boolean.gemspec
init.rb

README.md

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.