nigilist 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/VERSION +1 -1
- data/lib/nigilist.rb +2 -0
- data/nigilist.gemspec +2 -2
- data/test/nihilist_test.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz: '
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '03859e345e50ed0007f19d98268f1592f010926105ca8574d489c95b1cd62319'
|
4
|
+
data.tar.gz: 9e116b02024911bd4c539f255e8cf44f60341b3633055d192273ce7d824446cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76bb2c37211677ce4bb4a7e691438d69a0421f5dcca715b5d45396887a32e20542d47725f0854c26bcf53a254e56ca05c1233ad4fdde36cb7df46eebf1413dec
|
7
|
+
data.tar.gz: dca4da8b1109575a2ea6ab0b5ad503aebd6c66f8548492463e416ac17b55c872c6769554ff2438e972e6a0854bc5b983bacf36302e25f6c246dcc3a7c797600d
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Nigilist
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/nigilist.svg)](https://rubygems.org/gems/nigilist)
|
4
4
|
[![Build Status](https://travis-ci.org/aishek/nihilist.svg?branch=master)](https://travis-ci.org/aishek/nihilist)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/aishek/nihilist.svg)](https://codeclimate.com/github/aishek/nihilist)
|
6
6
|
|
7
7
|
|
8
|
-
Nigilist is extremely useful for implement Null Object pattern. It allows null object to return `false` for all question-methods,
|
8
|
+
Nigilist is extremely useful for implement Null Object pattern. It allows null object to return `false` for all question-methods, `nil` for all non-bang-methods, `[]` for all methods in plural form without defining them.
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -33,6 +33,7 @@ current_user.admin? # false
|
|
33
33
|
current_user.polite? # true
|
34
34
|
current_user.address # nil
|
35
35
|
current_user.locale # 'ru'
|
36
|
+
current_user.planets # []
|
36
37
|
```
|
37
38
|
|
38
39
|
### Explanation of Null Object pattern
|
@@ -63,6 +64,7 @@ Gem nigilist is maintained by [Cifronomika](http://cifronomika.ru/).
|
|
63
64
|
Contributors:
|
64
65
|
|
65
66
|
* [Alexandr Borisov](https://github.com/aishek)
|
67
|
+
* [Ivan Nemytchenko](https://github.com/inem)
|
66
68
|
|
67
69
|
## The gem about one method
|
68
70
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/nigilist.rb
CHANGED
data/nigilist.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: nigilist 0.0
|
5
|
+
# stub: nigilist 0.1.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "nigilist".freeze
|
9
|
-
s.version = "0.0
|
9
|
+
s.version = "0.1.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.metadata = { "allowed_push_host" => "https://rubygems.org" } if s.respond_to? :metadata=
|
data/test/nihilist_test.rb
CHANGED
@@ -36,4 +36,16 @@ class NigilistTest < Minitest::Test
|
|
36
36
|
def test_defined_non_bang_end_method_return_its_result
|
37
37
|
assert { @guest.planet == 'Earth' }
|
38
38
|
end
|
39
|
+
|
40
|
+
def test_undefined_plural_method_return_its_result
|
41
|
+
assert { @guest.planets == [] }
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_undefined_plural_method_with_undersores_return_its_result
|
45
|
+
assert { @guest.planets_and_monkeys == [] }
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_undefined_plural_method_with_undersore_at_the_end_return_its_result
|
49
|
+
assert { @guest.monkeys_ == [] }
|
50
|
+
end
|
39
51
|
end
|