ruby-try 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,11 +1,14 @@
1
1
  Ruby Try
2
2
  ========
3
+ [![Gem Version](https://badge.fury.io/rb/ruby-try.svg)](http://badge.fury.io/rb/ruby-try)
4
+ [![Code Climate](https://codeclimate.com/github/OrelSokolov/ruby-try/badges/gpa.svg)](https://codeclimate.com/github/OrelSokolov/ruby-try)
5
+
3
6
  This gem has two versions of `try()`.
4
7
 
5
8
  * **Vanilla `try()`**
6
- * This is RoR vanilla `try()` and `try!()`. Nothing new.
9
+ * RoR vanilla `try()` and `try!()`. Nothing new.
7
10
  * **Boolean `try?()`**
8
- * This is `try()` for boolean functions. It is returns `false` instead of `nil`, when trying to call
11
+ * `try()` for boolean functions. It is returns `false` instead of `nil`, when trying to call
9
12
  something like `nil.try(:some_boolean_method?)`
10
13
 
11
14
  ```ruby
@@ -21,6 +24,7 @@ Why boolean `try?`
21
24
  =================
22
25
 
23
26
  Imagine, we have something like this:
27
+
24
28
  ```ruby
25
29
  def admin_in_team?(team)
26
30
  if m = team_members.find_by_team_id(team.id)
@@ -32,6 +36,7 @@ end
32
36
  ```
33
37
 
34
38
  Of course, it is better to write something like
39
+
35
40
  ```
36
41
  def admin_in_team?(team)
37
42
  team_members.find_by_team_id(team.id).try(:admin?)
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'ruby-try'
7
- spec.version = '1.0.1'
7
+ spec.version = '1.0.2'
8
8
  spec.date = '2014-08-02'
9
9
  spec.summary = "Provides RoR try() and extends it by new try?() method."
10
10
  spec.description = "Provides RoR try() and extends it by new try?() method."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-try
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -56,8 +56,6 @@ files:
56
56
  - README.md
57
57
  - Rakefile
58
58
  - lib/ruby-try.rb
59
- - lib/ruby/try.rb
60
- - lib/ruby/try/version.rb
61
59
  - ruby-try.gemspec
62
60
  - spec/ruby_try_spec.rb
63
61
  - spec/spec_helper.rb
@@ -1,7 +0,0 @@
1
- require "ruby/try/version"
2
-
3
- module Ruby
4
- module Try
5
- # Your code goes here...
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- module Ruby
2
- module Try
3
- VERSION = "0.0.1"
4
- end
5
- end