active_nothing 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8bfb08f6b1f2cb1e0cdbf7fb329778572f8b5095
4
+ data.tar.gz: 66ff87b5156897a7e0f341bbc927d63b4b684f1c
5
+ SHA512:
6
+ metadata.gz: c6cd3310715181e99561e5f774fd22f368ed44ab1275d4ba44d10da8594332c1671f5a06dc3ebf8d295272b1d2dffdf0611227e00542bb26a79d6e44dd83e895
7
+ data.tar.gz: 9b22fbcd4742088ab9ab99f02182460b8816448f048cc4423b80a37d62b21c1c0cd536ee9d93b6b13e3bd116d3a25487bae518bb6b78c984946cefa203a05fae
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.1
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,49 @@
1
+ # ActiveNothing
2
+
3
+ A ruby gem inspired by [a talk from Sandi Metz](https://youtu.be/9lv2lBq6x4A) and [Yehuda Katz blogpost](http://yehudakatz.com/2009/10/04/emulating-smalltalks-conditionals-in-ruby/) for better flow of conditions.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'active_nothing'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install active_nothing
20
+
21
+ ## Usage
22
+
23
+ After doing:
24
+
25
+ require 'active_nothing'
26
+
27
+ You now have an access to inverse conditional flow like:
28
+
29
+ [true, false, nil, Object, 0, 1, "", [1, 2, 3], {}].each do |value|
30
+ value
31
+ .if_true { p "#{value} is truthy" }
32
+ .if_false { p "#{value} is falsey" }
33
+ end
34
+
35
+ You can use it as you wish.
36
+
37
+ ## Development
38
+
39
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
40
+
41
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it ( https://github.com/[my-github-username]/active_nothing/fork )
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ require 'active_nothing/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'active_nothing'
10
+ spec.version = ActiveNothing::VERSION
11
+ spec.authors = ['Kamil Lelonek']
12
+ spec.email = ['squixy.sln@gmail.com']
13
+
14
+ spec.summary = %q{Ruby conditionals from Smalltalk}
15
+ spec.description = %q{A ruby gem inspired by a talk from Sandi Metz (https://youtu.be/9lv2lBq6x4A) and Yehuda Katz blogpost (http://yehudakatz.com/2009/10/04/emulating-smalltalks-conditionals-in-ruby/) for better conditions' flow.}
16
+ spec.homepage = 'https://github.com/KamilLelonek/active_nothing.git'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.9'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'pry-byebug', '~> 3.1.0'
26
+ spec.add_development_dependency 'rspec', '~> 3.2.0'
27
+ end
28
+
29
+
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'active_nothing'
5
+
6
+ require 'pry'
7
+ Pry.start
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+ IFS=$'\n\t'
5
+
6
+ bundle
@@ -0,0 +1,4 @@
1
+ require 'active_nothing/version'
2
+ require 'active_nothing/nil'
3
+ require 'active_nothing/false'
4
+ require 'active_nothing/object'
@@ -0,0 +1,10 @@
1
+ class FalseClass
2
+ def if_true
3
+ self
4
+ end
5
+
6
+ def if_false
7
+ yield
8
+ self
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class NilClass
2
+ def if_true
3
+ self
4
+ end
5
+
6
+ def if_false
7
+ yield
8
+ self
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class Object
2
+ def if_true
3
+ yield
4
+ self
5
+ end
6
+
7
+ def if_false
8
+ self
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveNothing
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_nothing
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kamil Lelonek
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-04-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.1.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.2.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.2.0
69
+ description: A ruby gem inspired by a talk from Sandi Metz (https://youtu.be/9lv2lBq6x4A)
70
+ and Yehuda Katz blogpost (http://yehudakatz.com/2009/10/04/emulating-smalltalks-conditionals-in-ruby/)
71
+ for better conditions' flow.
72
+ email:
73
+ - squixy.sln@gmail.com
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - ".travis.yml"
81
+ - Gemfile
82
+ - README.md
83
+ - Rakefile
84
+ - active_nothing.gemspec
85
+ - bin/console
86
+ - bin/setup
87
+ - lib/active_nothing.rb
88
+ - lib/active_nothing/false.rb
89
+ - lib/active_nothing/nil.rb
90
+ - lib/active_nothing/object.rb
91
+ - lib/active_nothing/version.rb
92
+ homepage: https://github.com/KamilLelonek/active_nothing.git
93
+ licenses: []
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.4.6
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Ruby conditionals from Smalltalk
115
+ test_files: []