rufus-dollar 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,11 @@
2
2
  = rufus-dollar CHANGELOG.txt
3
3
 
4
4
 
5
+ == rufus-dollar - 1.0.4 released 2010/12/24
6
+
7
+ - ${string} => string / ${array/hash} => array/hash .inspect
8
+
9
+
5
10
  == rufus-dollar - 1.0.3 released 2010/12/22
6
11
 
7
12
  - ${'key} and ${"key} produce '"value"'
data/Rakefile CHANGED
@@ -61,7 +61,7 @@ end
61
61
  Rake::RDocTask.new do |rd|
62
62
 
63
63
  rd.main = 'README.txt'
64
- rd.rdoc_dir = 'rdoc'
64
+ rd.rdoc_dir = "rdoc/#{GEMSPEC.name}"
65
65
 
66
66
  rd.rdoc_files.include('README.txt', 'CHANGELOG.txt', 'lib/**/*.rb')
67
67
 
@@ -36,7 +36,7 @@ module Rufus
36
36
 
37
37
  module Dollar
38
38
 
39
- VERSION = '1.0.3'
39
+ VERSION = '1.0.4'
40
40
 
41
41
  # Performs 'dollar substitution' on a piece of text with a given
42
42
  # dictionary.
@@ -92,7 +92,15 @@ module Rufus
92
92
  end
93
93
 
94
94
  value = dict[key]
95
- value = value.nil? ? '' : value.to_s
95
+
96
+ value = if value.nil?
97
+ ''
98
+ elsif value.is_a?(String)
99
+ value
100
+ else
101
+ value.inspect
102
+ end
103
+
96
104
  value = value.inspect if quote
97
105
 
98
106
  pre = (i > 0) ? text[0..i-1] : ''
@@ -17,7 +17,9 @@ describe Rufus::Dollar do
17
17
  'renard' => 'goupil',
18
18
  'cane' => 'oie',
19
19
  'oie blanche' => 'poule',
20
- 'x' => 'y'
20
+ 'x' => 'y',
21
+ 'customers' => %w[ alice bob ],
22
+ 'table' => { 2011 => 2, 2012 => 7 }
21
23
  }
22
24
  end
23
25
 
@@ -63,6 +65,16 @@ describe Rufus::Dollar do
63
65
 
64
66
  dsub("le petit ${chien} suisse").should == "le petit suisse"
65
67
  end
68
+
69
+ it "'inspects' arrays" do
70
+
71
+ dsub("the ${customers}").should == 'the ["alice", "bob"]'
72
+ end
73
+
74
+ it "'inspects' hashes" do
75
+
76
+ dsub("${table}").should == '{2011=>2, 2012=>7}'
77
+ end
66
78
  end
67
79
  end
68
80
 
@@ -97,7 +109,7 @@ describe Rufus::Dollar do
97
109
 
98
110
  let(:dict) do
99
111
  {
100
- 'renard' => 'goupil',
112
+ 'renard' => 'goupil'
101
113
  }
102
114
  end
103
115
 
metadata CHANGED
@@ -3,49 +3,49 @@ name: rufus-dollar
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
- - 1
7
- - 0
8
- - 3
9
- version: 1.0.3
6
+ - 1
7
+ - 0
8
+ - 4
9
+ version: 1.0.4
10
10
  platform: ruby
11
11
  authors:
12
- - John Mettraux
12
+ - John Mettraux
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-22 00:00:00 +09:00
17
+ date: 2010-12-24 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: rake
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
30
- type: :development
31
- version_requirements: *id001
32
- - !ruby/object:Gem::Dependency
33
- name: rspec
34
- prerelease: false
35
- requirement: &id002 !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- segments:
40
- - 2
41
- - 0
42
- version: "2.0"
43
- type: :development
44
- version_requirements: *id002
20
+ - !ruby/object:Gem::Dependency
21
+ name: rake
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: rspec
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 2
41
+ - 0
42
+ version: "2.0"
43
+ type: :development
44
+ version_requirements: *id002
45
45
  description: "\n\
46
46
  ${xxx} substitutions\n "
47
47
  email:
48
- - jmettraux@gmail.com
48
+ - jmettraux@gmail.com
49
49
  executables: []
50
50
 
51
51
  extensions: []
@@ -53,16 +53,16 @@ extensions: []
53
53
  extra_rdoc_files: []
54
54
 
55
55
  files:
56
- - Rakefile
57
- - lib/rufus-dollar.rb
58
- - lib/rufus/dollar.rb
59
- - spec/dollar_spec.rb
60
- - spec/spec_base.rb
61
- - spec/support/dollar_helper.rb
62
- - rufus-dollar.gemspec
63
- - CHANGELOG.txt
64
- - LICENSE.txt
65
- - README.txt
56
+ - Rakefile
57
+ - lib/rufus/dollar.rb
58
+ - lib/rufus-dollar.rb
59
+ - spec/dollar_spec.rb
60
+ - spec/spec_base.rb
61
+ - spec/support/dollar_helper.rb
62
+ - rufus-dollar.gemspec
63
+ - CHANGELOG.txt
64
+ - LICENSE.txt
65
+ - README.txt
66
66
  has_rdoc: true
67
67
  homepage: http://rufus.rubyforge.org
68
68
  licenses: []
@@ -71,21 +71,21 @@ post_install_message:
71
71
  rdoc_options: []
72
72
 
73
73
  require_paths:
74
- - lib
74
+ - lib
75
75
  required_ruby_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- segments:
80
- - 0
81
- version: "0"
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
81
+ version: "0"
82
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- segments:
87
- - 0
88
- version: "0"
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ segments:
87
+ - 0
88
+ version: "0"
89
89
  requirements: []
90
90
 
91
91
  rubyforge_project: rufus