space2underscore 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/space2underscore +3 -2
- data/lib/space2underscore/version.rb +1 -1
- data/lib/space2underscore.rb +6 -4
- data/spec/space2underscore_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a741e7b5f27c13b47aadb914b79618e0f41c2c4
|
4
|
+
data.tar.gz: feeb162aee9722aad1749071d920a62d2cb44462
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b69ef33be0c96d314fe810480e875ad6b8afa8657128dd031b16c4371a8b0aeab763759edc38ec6e7f0d93d9d06a6876f5697ce9b999505f1b5624a78443d2c
|
7
|
+
data.tar.gz: 13d3474faca70effa7686450abdbbf1e00f38672fa2f4ee34cdf43071e8bd03d98385b7138c85004d538d43de1df91a156f8735fc95eb1d8a44540360b2d3da0
|
data/bin/space2underscore
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'space2underscore'
|
4
4
|
|
5
|
-
result
|
6
|
-
|
5
|
+
result = Space2underscore.convert_to_underscore(ARGV)
|
6
|
+
command = Space2underscore.copy_command(result)
|
7
|
+
puts result.first; system(command)
|
data/lib/space2underscore.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'space2underscore/version'
|
2
2
|
|
3
3
|
module Space2underscore
|
4
|
-
def self.
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
def self.convert(argv)
|
5
|
+
argv.length == 1 ? argv.first.gsub(/\s/, '_') : argv.join('_')
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.copy_command(space_include_sentence)
|
9
|
+
"echo #{space_include_sentence} | ruby -pe 'chomp' | pbcopy"
|
8
10
|
end
|
9
11
|
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Space2underscore do
|
4
4
|
it 'Successful execution' do
|
5
|
-
expect(Space2underscore.
|
6
|
-
expect(Space2underscore.
|
5
|
+
expect(Space2underscore.convert(['fuga hoge foo'])).to eq('fuga_hoge_foo') # String case
|
6
|
+
expect(Space2underscore.convert(%w(fuga hoge foo))).to eq('fuga_hoge_foo') # Array case
|
7
7
|
end
|
8
8
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: space2underscore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sachin21
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|