abstract_command 0.0.7 → 0.0.8

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: d7d962f4d270e21692dc110cd7b1ad2fef5b53be412a3c647f480747ba5f78e0
4
- data.tar.gz: 610073595394448b95394c5f778bc7768afe88c19040aa9b45169cb3a49ef462
3
+ metadata.gz: 9ba889bea5d22de45ed1a51494769807bc332b09cda2db7548eb375f5b5c7d4d
4
+ data.tar.gz: 138147f976e27b00925e9fe5627ff895400931b6924dc64473880ba81a53e937
5
5
  SHA512:
6
- metadata.gz: 48d1dc40f33242eb194071aab72619ada6a4b2422308e856076e0a1f0e0cce024d2aa254124fe0ebc4518043cb14997be0d9ad400672cb23542669c61a3f0235
7
- data.tar.gz: ad6414be1b6f4aad84282b6f75293eac55d7e07c268dde7edc57481ec8a996c5d3aa0c694127f34f10bcecb0ad0e16e7c3035077c348477a7bb87f8318b4165e
6
+ metadata.gz: 8e121b83d22e0ccd997dd0ca53e0f25c68a6466dc2e2e16cca2fa8ef1bdfbd70bb453149ab4476d82bff9472c5dfaff9fcd1bbaa97b59026ed2d33767d09a2b9
7
+ data.tar.gz: 6325953eb38c30498e6d5af206191bcdef03228959936d673fb9c4e0c6681c20733055e9141aacb7e80768c88c5f10e20ce9db15a39b514da55d4321f3bd7f8c
@@ -1,6 +1,5 @@
1
1
  require 'open3'
2
2
  require 'shellwords'
3
- require './lib/formatter.rb'
4
3
 
5
4
  # Shell Command Abstraction.
6
5
  #
@@ -25,6 +24,21 @@ require './lib/formatter.rb'
25
24
  #
26
25
  class AbstractCommand
27
26
 
27
+ # before ruby 1.9.1 the format method does not support
28
+ # the syntax we want, so we have a simplified version of
29
+ # format for older versions of ruby.
30
+ # its placed in the AbstractCommand class because we want
31
+ # to avoid possible collisions for people requiring our code.
32
+ # It can live on a better place though..
33
+ class Formatter
34
+ REGEXP = /(%<)(\S+)(>\w)/
35
+ def self.format(template, params)
36
+ template.gsub(REGEXP) do
37
+ params[$2.to_sym]
38
+ end
39
+ end
40
+ end
41
+
28
42
  # '%<name>s'.scan(/(%<)(\w+)(>)/)
29
43
  # => [["%<", "name", ">"]]
30
44
  VARIABLE_REGEX = /(%<)(\w+)(>)/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abstract_command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuyoshi Tlacaelel
@@ -17,7 +17,6 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/abstract_command.rb
20
- - lib/formatter.rb
21
20
  homepage: http://rubygems.org/gems/abstract_command
22
21
  licenses:
23
22
  - MIT
data/lib/formatter.rb DELETED
@@ -1,17 +0,0 @@
1
-
2
- # before ruby 1.9.1 the format method does not support
3
- # the syntax we want, so we have a simplified version of
4
- # format for older versions of ruby.
5
- # its placed in the AbstractCommand class because we want
6
- # to avoid possible collisions for people requiring our code.
7
- # It can live on a better place though..
8
- class AbstractCommand
9
- class Formatter
10
- REGEXP = /(%<)(\S+)(>\w)/
11
- def self.format(template, params)
12
- template.gsub(REGEXP) do
13
- params[$2.to_sym]
14
- end
15
- end
16
- end
17
- end