https://github.com/tubbo/sartre
Give any Ruby method a "?" suffix for converting its result into a boolean value.
https://github.com/tubbo/sartre
Last synced: about 1 month ago
JSON representation
Give any Ruby method a "?" suffix for converting its result into a boolean value.
- Host: GitHub
- URL: https://github.com/tubbo/sartre
- Owner: tubbo
- License: mit
- Created: 2013-07-22T23:27:35.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T08:48:54.000Z (over 1 year ago)
- Last Synced: 2025-01-25T08:25:02.994Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Sartre
Existential check for all object methods in Ruby. Convert any method
into a boolean value by simply appending '?' to the method name.## Installation
Add this line to your application's Gemfile:
gem 'sartre'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sartre
## Usage
Sartre will allow you to test the "existence" of any method on any
object in Ruby...```ruby
require 'sartre'class TestClass
attr_accessor :namedef initialize
@name = "my name"
end
endtest = TestClass.new
test.name? # => true
test.name = nil
test.name? # => false
```## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request