string-present-blank 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 9c54dc63b6d988034eb97bee826c13867c580f96
4
- data.tar.gz: 6380e3bb0cf1b5a6a8b21265f14c30cde720edbd
3
+ metadata.gz: 32608198f53b418a69966e5c693f34a20b1ab6a2
4
+ data.tar.gz: b53f5b49254bbf9fa4083e2774ef63f8775028cf
5
5
  SHA512:
6
- metadata.gz: bda4bb1a3aa7edae1436580dccb0d8ffbfbde0dc6219f125311d3bba8c1cdd23f3c8a786ddfe9f723fa9846d0ce258f80aee58a03c373e3d84f7acb3d6d53cb4
7
- data.tar.gz: 65a068559e21f7da8223167d8c14a2a80671cf0cd9910e1cbeab3145e42499b5cd8b73bfb95c453796286f4221f39312e14a7f96a26af40aa82096b29a21112f
6
+ metadata.gz: ecc5ede38158c6dc31120ec256674c2e9e2f57effb12ea6fefa3c21c9cbad7f18eb7d03de3e110584d0569f5d4745abd8ca2fe3ceba80f9e5f7ff4e45d1a9d24
7
+ data.tar.gz: dc40044e0c654edebf309a908a8ab2df5974da9809772431acd78777f9c10826464d196cdc6ce9f61edd4199fd00a9f8e8b9ff1b5ab3ebbe905863c8ca39418b
data/README.md CHANGED
@@ -2,41 +2,47 @@
2
2
 
3
3
  This gem provides String#present and String#blank.
4
4
 
5
- ## Installation
5
+ ## Usage
6
6
 
7
- Add this line to your application's Gemfile:
7
+ ### Before
8
8
 
9
- gem 'string-present-blank'
9
+ ```ruby
10
+ 'abc' + 'efg' #=> 'abcefg'
11
+ 'abc' + 'efg' if false #=> nil
12
+ 'abc' + ('efg' if false) #=> TypeError: no implicit conversion of nil into String
13
+ 'abc' + if false then 'efg' else '' end #=> 'abc'
14
+ ```
10
15
 
11
- And then execute:
16
+ ### After
12
17
 
13
- $ bundle
18
+ ```ruby
19
+ 'abc' + 'efg'.blank(if: true) #=> 'abc'
20
+ 'abc' + 'efg'.present(unless: true) #=> 'abc'
21
+ ```
14
22
 
15
- Or install it yourself as:
23
+ ### Examples
16
24
 
17
- $ gem install string-present-blank
25
+ ```haml
26
+ %div= link_to('abc', abc_path, class: 'abc'.present(if: abc?))
27
+ ```
18
28
 
19
- ## Usage
29
+ ## Installation
20
30
 
21
- ```ruby
22
- # before
31
+ Add this line to your application's Gemfile:
23
32
 
24
- 'abc' + 'efg' #=> 'abcefg'
33
+ gem 'string-present-blank'
25
34
 
26
- 'abc' + 'efg' if false #=> nil
27
- 'abc' + ('efg' if false) #=> TypeError: no implicit conversion of nil into String
28
- 'abc' + if false then 'efg' else '' end #=> 'abc'
35
+ And then execute:
29
36
 
30
- # after
37
+ $ bundle
31
38
 
32
- 'abc' + 'efg'.blank(if: false) #=> 'abc'
33
- 'abc' + 'efg'.present(unless: false) #=> 'abc'
39
+ Or install it yourself as:
34
40
 
35
- ```
41
+ $ gem install string-present-blank
36
42
 
37
43
  ## Contributing
38
44
 
39
- 1. Fork it ( https://github.com/[my-github-username]/string-present-blank/fork )
45
+ 1. Fork it ( https://github.com/tachiba/string-present-blank/fork )
40
46
  2. Create your feature branch (`git checkout -b my-new-feature`)
41
47
  3. Commit your changes (`git commit -am 'Add some feature'`)
42
48
  4. Push to the branch (`git push origin my-new-feature`)
data/Rakefile CHANGED
@@ -1,9 +1,9 @@
1
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
2
2
  require 'rake/testtask'
3
3
 
4
4
  Rake::TestTask.new do |t|
5
- t.libs << 'test'
6
- t.libs << '.'
5
+ t.libs << "test"
6
+ t.libs << "."
7
7
  t.test_files = FileList['test/test*.rb']
8
8
  t.verbose = true
9
9
  t.warning = true
@@ -1,3 +1 @@
1
- require 'string-present-blank/string'
2
-
3
- String.include(StringPresentBlank::String)
1
+ require 'string_present_blank'
@@ -0,0 +1,3 @@
1
+ require 'string_present_blank/string'
2
+
3
+ String.include(StringPresentBlank::String)
@@ -1,3 +1,3 @@
1
1
  module StringPresentBlank
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
@@ -1,15 +1,15 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'string-present-blank/version'
4
+ require 'string_present_blank/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = 'string-present-blank'
7
+ spec.name = "string-present-blank"
8
8
  spec.version = StringPresentBlank::VERSION
9
- spec.authors = ['Takashi Chiba']
10
- spec.email = ['contact@takashi.me']
9
+ spec.authors = ["Takashi Chiba"]
10
+ spec.email = ["contact@takashi.me"]
11
11
  spec.summary = %q{Provides String#present and String#blank.}
12
- spec.homepage = 'http://takashi.me'
12
+ spec.homepage = 'https://github.com/tachiba/ruby-string-present-blank'
13
13
  spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0")
data/test/test_string.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  require 'minitest/autorun'
2
- require 'string-present-blank'
2
+ require 'string_present_blank'
3
+ require 'string-present-blank' # raises no error
3
4
 
4
- class TestString < MiniTest::Unit::TestCase
5
+ class TestString < Minitest::Test
5
6
  def test_present
6
7
  assert_equal 'hogehoge', 'hogehoge'.present
7
8
  assert_equal 'hogehoge', 'hogehoge'.present(if: true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string-present-blank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Chiba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-06 00:00:00.000000000 Z
11
+ date: 2014-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,11 +66,12 @@ files:
66
66
  - README.md
67
67
  - Rakefile
68
68
  - lib/string-present-blank.rb
69
- - lib/string-present-blank/string.rb
70
- - lib/string-present-blank/version.rb
69
+ - lib/string_present_blank.rb
70
+ - lib/string_present_blank/string.rb
71
+ - lib/string_present_blank/version.rb
71
72
  - string-present-blank.gemspec
72
73
  - test/test_string.rb
73
- homepage: http://takashi.me
74
+ homepage: https://github.com/tachiba/ruby-string-present-blank
74
75
  licenses:
75
76
  - MIT
76
77
  metadata: {}