nigilist 0.0.1 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0334689325cf628d99a8efb459006d81ecb413351f2e9fa1ddc30938e801c60a'
4
- data.tar.gz: b7019471120fc97630677f7fd349b84851d4d6d5b92c11a845dc266e1481ac4f
3
+ metadata.gz: '03859e345e50ed0007f19d98268f1592f010926105ca8574d489c95b1cd62319'
4
+ data.tar.gz: 9e116b02024911bd4c539f255e8cf44f60341b3633055d192273ce7d824446cf
5
5
  SHA512:
6
- metadata.gz: c8da51f5d735d143a3d3d86724253228deeddfd93004c39362f84c6453c5764717537b9942899305b32a9d83f1a57e960483907d5b023a3f1cd31cb75af5d5f8
7
- data.tar.gz: 4d5a2dcd11ea3a97bebfef5303c4dee048a26ed6bec17e93eb27697f2a28c186f2d1ebe527761d95d9fb647c78bf82a8bd9d94dda2fefda964020904d48d2d7a
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/nihilist.svg)](https://rubygems.org/gems/nihilist)
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, and `nil` for all non-bang-methods without defining them.
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
1
+ 0.1.0
data/lib/nigilist.rb CHANGED
@@ -3,6 +3,8 @@ module Nigilist
3
3
  method_name = message.to_s
4
4
  if method_name.end_with?('?')
5
5
  false
6
+ elsif method_name.split("_").last.end_with?('s')
7
+ []
6
8
  elsif !method_name.end_with?('!')
7
9
  nil
8
10
  else
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.1 ruby lib
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.1"
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=
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nigilist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandr Borisov