zucker 12.1 → 13.1

Sign up to get free protection for your applications and to get access to all the features.
data/doc/zucker_doc.rb CHANGED
@@ -92,7 +92,7 @@ class ZuckerDoc
92
92
  file.puts result
93
93
  end
94
94
 
95
- puts "created Zucker documentation at #{File.expand_path(output_path)}"
95
+ puts "Created Zucker documentation at #{File.expand_path(output_path)}"
96
96
  end
97
97
 
98
98
  protected
@@ -129,7 +129,7 @@ class ZuckerDoc
129
129
  def methods(m)
130
130
  m.map{ |name, usage|
131
131
  "<h5>#{replace_html_special_chars name}</h5>" +
132
- "<pre class=\"usage source\" style=\"display:block\">#{ syntax_highlight usage }</pre>"
132
+ "<div class=\"usage source\" style=\"display:block\">#{ syntax_highlight usage }</div>"
133
133
  }.join
134
134
  end
135
135
 
@@ -174,9 +174,9 @@ class ZuckerDoc
174
174
 
175
175
  def source_helper(kind, file_prefix, suffix='')
176
176
  %{ <span id="show_#{@cube_name}_#{kind}">(<a href="javascript:show('#{@cube_name}_#{kind}')">show</a>)</span>
177
- <pre class="source" id="#{@cube_name}_#{kind}">#{
177
+ <div class="source" id="#{@cube_name}_#{kind}">#{
178
178
  get_source_file( File.join file_prefix, ( @cube_name + suffix + '.rb' ) )
179
- }</pre> }
179
+ }</div> }
180
180
  end
181
181
 
182
182
  def get_source_file(filename)
@@ -189,7 +189,7 @@ class ZuckerDoc
189
189
 
190
190
  def syntax_highlight(string)
191
191
  #convert_html_chars
192
- CodeRay.scan(string, :ruby).html
192
+ CodeRay.scan(string, :ruby).div
193
193
  end
194
194
 
195
195
  def replace_html_special_chars(string)
data/lib/zucker.rb CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Zucker
4
4
  # version and date get modified by the :prepare_release rake task
5
- VERSION = '12.1'
6
- DATE = '2012-01-16'
5
+ VERSION = '13.1'
6
+ DATE = '2013-04-30'
7
7
 
8
8
  # cube list
9
9
  PACKS = {
@@ -16,7 +16,7 @@ module Zucker
16
16
  :debug => %w|binding cc dd mm oo qq regexp_visualize|,
17
17
  }
18
18
 
19
- NON_1_8_CUBES = %w|not|
19
+ NON_1_8_CUBES = %w|not case|
20
20
 
21
21
  class << self
22
22
  # Zucker require helpers
@@ -3,7 +3,7 @@ module Zucker AliasFor = true end
3
3
 
4
4
  def alias_for(m, *aliases)
5
5
  aliases.each{ |a|
6
- class_eval "alias #{a} #{m}"
6
+ class_eval "alias :'#{ a.to_s }' :'#{ m.to_s }'"
7
7
  }
8
8
  end
9
9
  alias aliases_for alias_for
data/lib/zucker/array.rb CHANGED
@@ -2,19 +2,8 @@ require 'zucker'
2
2
  module Zucker Array = true end
3
3
 
4
4
  class Array
5
- def ^(other) # TODO: more efficient
6
- (self - other) +
7
- (other - self)
8
- end
9
-
10
- # can take an argument & block to be Rails compatible
11
- def sum(identity = 0, &block)
12
- # inject(:+)
13
- if block_given?
14
- map(&block).sum( identity )
15
- else
16
- inject(:+) || identity
17
- end
5
+ def ^(other)
6
+ (self - other) + (other - self)
18
7
  end
19
8
 
20
9
  def chrs
data/lib/zucker/engine.rb CHANGED
@@ -29,6 +29,7 @@ module RubyEngine
29
29
  def to_s
30
30
  @interpreter.to_s
31
31
  end
32
+ alias inspect to_s
32
33
 
33
34
  # ask methods
34
35
 
@@ -8,6 +8,7 @@ module RubyVersion
8
8
  def to_s
9
9
  RUBY_VERSION
10
10
  end
11
+ alias inspect to_s
11
12
 
12
13
  # comparable
13
14
  def <=>(other)
@@ -18,11 +18,11 @@ describe 'alias_for' do
18
18
  def m2
19
19
  2
20
20
  end
21
- alias_for :m2, :a2
21
+ aliases_for :m2, :a2, :'a-2'
22
22
  end
23
23
  proc do
24
-
25
24
  [1,2,3].a2.should == 2
25
+ [1,2,3].send('a-2').should == 2
26
26
  end.should_not raise_exception
27
27
  end
28
28
 
data/spec/array_spec.rb CHANGED
@@ -8,13 +8,6 @@ describe 'Array#^' do
8
8
  end
9
9
  end
10
10
 
11
- describe 'Array#sum' do
12
- it 'should sum the array' do
13
- [1,2,3,4,5].sum.should == 15
14
- %w|More Ruby|.sum.should == 'MoreRuby'
15
- end
16
- end
17
-
18
11
  describe 'Array#chrs' do
19
12
  it 'should convert the array to a string, using each element as ord value for the char' do
20
13
  [72, 97, 108, 108, 111].chrs.should == 'Hallo'
data/spec/case_spec.rb CHANGED
@@ -1,13 +1,15 @@
1
- require 'zucker/case'
1
+ if defined? BasicObject # 1.9 only
2
+ require 'zucker/case'
2
3
 
3
- describe 'String#to_camel' do
4
- it 'should turn a snake_cased string to CamelCase' do
5
- 'was_snake_case'.to_camel.should == 'WasSnakeCase'
4
+ describe 'String#to_camel' do
5
+ it 'should turn a snake_cased string to CamelCase' do
6
+ 'was_snake_case'.to_camel.should == 'WasSnakeCase'
7
+ end
6
8
  end
7
- end
8
9
 
9
- describe 'String#to_snake' do
10
- it 'should turn a CamelCased string to snake_case' do
11
- 'WasCamelCase'.to_snake.should == 'was_camel_case'
10
+ describe 'String#to_snake' do
11
+ it 'should turn a CamelCased string to snake_case' do
12
+ 'WasCamelCase'.to_snake.should == 'was_camel_case'
13
+ end
12
14
  end
13
15
  end
data/spec/not_spec.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  if defined? BasicObject # 1.9 only
2
-
3
2
  require 'zucker/not'
4
3
 
5
4
  describe 'Object#not' do
@@ -8,5 +7,4 @@ if defined? BasicObject # 1.9 only
8
7
  nil.not.nil?.should == false
9
8
  end
10
9
  end
11
-
12
10
  end
@@ -1,4 +1,4 @@
1
- require 'zucker/version'
1
+ require 'zucker/ruby_version'
2
2
  require 'date'
3
3
 
4
4
  describe 'RubyVersion' do
data/zucker.gemspec CHANGED
@@ -7,23 +7,23 @@ Gem::Specification.new do |s|
7
7
  s.version = Zucker::VERSION
8
8
  s.authors = ['Jan Lelis','others']
9
9
  s.email = 'mail@janlelis.de'
10
- s.summary = "Many little helpers that sweeten your Ruby code :)."
11
- s.description = "Sweetens your Ruby code with syntactic sugar :).
12
- Adds a lot of little helpers that you do not want to miss again."
10
+ s.summary = "Many little helpers that sweeten your Ruby code."
11
+ s.description = "Sweetens your Ruby code with syntactic sugar, which you do not want to miss again."
13
12
  s.homepage = "http://rubyzucker.info"
14
13
  s.files = Dir.glob( %w[{lib,spec}/**/*.rb desc/**/*.yaml] ) + %w{Rakefile zucker.gemspec MIT-LICENSE README CHANGELOG doc/zucker_doc.rb doc/zucker_doc.html .gemtest}
15
14
  s.require_paths = ["lib"]
16
15
  s.required_ruby_version = '>= 1.8.7' # 1.9 recommended
17
16
  s.license = 'MIT'
17
+ s.add_development_dependency 'rake'
18
18
  s.add_development_dependency 'rspec'
19
19
  s.add_development_dependency 'coderay'
20
20
 
21
- len = s.homepage.size
21
+ len = 24
22
22
  s.post_install_message = \
23
23
  (" ┌── " + "info ".ljust(len-2,'%') + "─┐\n" +
24
- " J-_-L │ " + s.homepage + " │\n" +
24
+ " J-_-L │ " + s.homepage.ljust(len,' ') + " │\n" +
25
25
  " ├── " + "usage ".ljust(len-2,'%') + "─┤\n" +
26
- " │ " + "require 'zucker/all'".ljust(len,' ') + " │\n" +
26
+ " │ " + "require 'zucker/default'".ljust(len,' ') + " │\n" +
27
27
  " │ " + "# or".ljust(len,' ') + " │\n" +
28
28
  " │ " + "require 'zucker/<name>".ljust(len,' ') + " │\n" +
29
29
  " └─" + '─'*len + "─┘").gsub('%', '─') # 1.8 workaround
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zucker
3
3
  version: !ruby/object:Gem::Version
4
- version: '12.1'
4
+ version: '13.1'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,27 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-01-16 00:00:00.000000000 Z
13
+ date: 2013-04-30 00:00:00.000000000 Z
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rake
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
15
31
  - !ruby/object:Gem::Dependency
16
32
  name: rspec
17
- requirement: &12652280 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
18
34
  none: false
19
35
  requirements:
20
36
  - - ! '>='
@@ -22,10 +38,15 @@ dependencies:
22
38
  version: '0'
23
39
  type: :development
24
40
  prerelease: false
25
- version_requirements: *12652280
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
26
47
  - !ruby/object:Gem::Dependency
27
48
  name: coderay
28
- requirement: &12651800 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
29
50
  none: false
30
51
  requirements:
31
52
  - - ! '>='
@@ -33,135 +54,135 @@ dependencies:
33
54
  version: '0'
34
55
  type: :development
35
56
  prerelease: false
36
- version_requirements: *12651800
37
- description: ! 'Sweetens your Ruby code with syntactic sugar :).
38
-
39
- Adds a lot of little helpers that you do not want to miss again.'
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ description: Sweetens your Ruby code with syntactic sugar, which you do not want to
64
+ miss again.
40
65
  email: mail@janlelis.de
41
66
  executables: []
42
67
  extensions: []
43
68
  extra_rdoc_files: []
44
69
  files:
45
- - lib/zucker/default.rb
46
- - lib/zucker/mm.rb
47
- - lib/zucker/class_to_proc.rb
48
- - lib/zucker/file.rb
49
- - lib/zucker/enumerable.rb
50
- - lib/zucker/env.rb
51
- - lib/zucker/tap.rb
70
+ - lib/zucker.rb
71
+ - lib/zucker/alias_for.rb
52
72
  - lib/zucker/extensions.rb
53
- - lib/zucker/egonil.rb
54
- - lib/zucker/binding.rb
73
+ - lib/zucker/control.rb
55
74
  - lib/zucker/iterate.rb
75
+ - lib/zucker/shortcuts.rb
76
+ - lib/zucker/not.rb
77
+ - lib/zucker/kernel.rb
78
+ - lib/zucker/cc.rb
56
79
  - lib/zucker/hash.rb
57
- - lib/zucker/oo.rb
58
- - lib/zucker/unary.rb
80
+ - lib/zucker/binding.rb
81
+ - lib/zucker/aliases.rb
59
82
  - lib/zucker/object.rb
83
+ - lib/zucker/regexp_visualize.rb
84
+ - lib/zucker/all.rb
85
+ - lib/zucker/mm.rb
86
+ - lib/zucker/class_to_proc.rb
87
+ - lib/zucker/os.rb
88
+ - lib/zucker/union.rb
60
89
  - lib/zucker/string.rb
90
+ - lib/zucker/file.rb
91
+ - lib/zucker/array_to_proc.rb
92
+ - lib/zucker/array.rb
93
+ - lib/zucker/engine.rb
61
94
  - lib/zucker/qq.rb
62
- - lib/zucker/to_proc.rb
95
+ - lib/zucker/egonil.rb
96
+ - lib/zucker/blank.rb
97
+ - lib/zucker/mcopy.rb
98
+ - lib/zucker/ivars.rb
99
+ - lib/zucker/hash_to_proc.rb
100
+ - lib/zucker/default.rb
63
101
  - lib/zucker/info.rb
64
- - lib/zucker/os.rb
102
+ - lib/zucker/case.rb
103
+ - lib/zucker/oo.rb
65
104
  - lib/zucker/regexp_to_proc.rb
66
105
  - lib/zucker/dd.rb
67
- - lib/zucker/array2proc.rb
68
- - lib/zucker/hash2proc.rb
69
- - lib/zucker/shortcuts.rb
70
- - lib/zucker/kernel.rb
71
- - lib/zucker/class2proc.rb
106
+ - lib/zucker/square_brackets_for.rb
107
+ - lib/zucker/to_proc.rb
108
+ - lib/zucker/enumerable.rb
109
+ - lib/zucker/debug.rb
110
+ - lib/zucker/unary.rb
72
111
  - lib/zucker/sandbox.rb
112
+ - lib/zucker/env.rb
113
+ - lib/zucker/tap.rb
73
114
  - lib/zucker/ruby_version.rb
74
- - lib/zucker/alias_for.rb
75
- - lib/zucker/array_to_proc.rb
76
- - lib/zucker/blank.rb
77
- - lib/zucker/debug.rb
78
- - lib/zucker/regexp2proc.rb
79
- - lib/zucker/hash_to_proc.rb
80
- - lib/zucker/control.rb
81
- - lib/zucker/square_brackets_for.rb
82
- - lib/zucker/case.rb
83
- - lib/zucker/ivars.rb
84
- - lib/zucker/cc.rb
85
- - lib/zucker/not.rb
86
- - lib/zucker/union.rb
87
- - lib/zucker/aliases.rb
88
- - lib/zucker/mcopy.rb
89
- - lib/zucker/all.rb
90
- - lib/zucker/array.rb
91
- - lib/zucker/engine.rb
92
- - lib/zucker/regexp_visualize.rb
93
- - lib/zucker.rb
94
- - spec/union_spec.rb
95
- - spec/cc_spec.rb
96
115
  - spec/tap_spec.rb
97
- - spec/iterate_spec.rb
98
- - spec/square_brackets_for_spec.rb
99
- - spec/string_spec.rb
100
- - spec/engine_spec.rb
101
- - spec/sandbox_spec.rb
102
- - spec/alias_for_spec.rb
103
- - spec/ivars_spec.rb
104
- - spec/enumerable_spec.rb
105
- - spec/regexp_visualize_spec.rb
106
- - spec/case_spec.rb
107
- - spec/egonil_spec.rb
108
- - spec/blank_spec.rb
109
- - spec/mcopy_spec.rb
110
- - spec/hash_spec.rb
111
116
  - spec/mm_spec.rb
112
- - spec/ruby_version_spec.rb
113
- - spec/spec_helper.rb
114
- - spec/not_spec.rb
115
- - spec/unary_spec.rb
116
- - spec/hash_to_proc_spec.rb
117
117
  - spec/oo_spec.rb
118
- - spec/regexp_to_proc_spec.rb
119
- - spec/qq_spec.rb
120
118
  - spec/binding_spec.rb
119
+ - spec/array_to_proc_spec.rb
120
+ - spec/ruby_version_spec.rb
121
+ - spec/string_spec.rb
122
+ - spec/union_spec.rb
121
123
  - spec/dd_spec.rb
122
- - spec/kernel_spec.rb
123
- - spec/array_spec.rb
124
- - spec/class_to_proc_spec.rb
124
+ - spec/sandbox_spec.rb
125
+ - spec/engine_spec.rb
126
+ - spec/egonil_spec.rb
125
127
  - spec/os_spec.rb
128
+ - spec/iterate_spec.rb
129
+ - spec/alias_for_spec.rb
126
130
  - spec/file_spec.rb
127
131
  - spec/info_spec.rb
128
- - spec/array_to_proc_spec.rb
132
+ - spec/class_to_proc_spec.rb
133
+ - spec/kernel_spec.rb
134
+ - spec/blank_spec.rb
135
+ - spec/qq_spec.rb
136
+ - spec/cc_spec.rb
137
+ - spec/not_spec.rb
138
+ - spec/case_spec.rb
139
+ - spec/array_spec.rb
140
+ - spec/square_brackets_for_spec.rb
141
+ - spec/unary_spec.rb
142
+ - spec/regexp_to_proc_spec.rb
143
+ - spec/spec_helper.rb
144
+ - spec/enumerable_spec.rb
145
+ - spec/ivars_spec.rb
146
+ - spec/mcopy_spec.rb
147
+ - spec/hash_to_proc_spec.rb
148
+ - spec/hash_spec.rb
149
+ - spec/regexp_visualize_spec.rb
129
150
  - spec/aliases_spec.rb
130
- - desc/array.yaml
131
- - desc/regexp_to_proc.yaml
132
- - desc/array_to_proc.yaml
133
- - desc/dd.yaml
134
- - desc/kernel.yaml
135
- - desc/hash_to_proc.yaml
136
- - desc/mm.yaml
137
- - desc/alias_for.yaml
151
+ - desc/class_to_proc.yaml
152
+ - desc/qq.yaml
153
+ - desc/file.yaml
154
+ - desc/tap.yaml
138
155
  - desc/union.yaml
139
- - desc/sandbox.yaml
140
- - desc/blank.yaml
141
- - desc/ruby_version.yaml
142
- - desc/cc.yaml
143
- - desc/case.yaml
156
+ - desc/dd.yaml
157
+ - desc/square_brackets_for.yaml
158
+ - desc/ivars.yaml
159
+ - desc/binding.yaml
160
+ - desc/os.yaml
161
+ - desc/engine.yaml
144
162
  - desc/oo.yaml
145
- - desc/not.yaml
146
- - desc/aliases.yaml
147
- - desc/regexp_visualize.yaml
148
163
  - desc/unary.yaml
149
- - desc/qq.yaml
164
+ - desc/alias_for.yaml
150
165
  - desc/egonil.yaml
151
- - desc/engine.yaml
152
- - desc/tap.yaml
153
- - desc/hash.yaml
154
- - desc/class_to_proc.yaml
155
166
  - desc/string.yaml
156
- - desc/binding.yaml
157
- - desc/mcopy.yaml
158
- - desc/file.yaml
167
+ - desc/mm.yaml
159
168
  - desc/iterate.yaml
160
- - desc/ivars.yaml
161
- - desc/enumerable.yaml
162
- - desc/square_brackets_for.yaml
163
- - desc/os.yaml
169
+ - desc/mcopy.yaml
170
+ - desc/case.yaml
171
+ - desc/not.yaml
172
+ - desc/hash_to_proc.yaml
173
+ - desc/array_to_proc.yaml
164
174
  - desc/info.yaml
175
+ - desc/regexp_to_proc.yaml
176
+ - desc/enumerable.yaml
177
+ - desc/array.yaml
178
+ - desc/cc.yaml
179
+ - desc/aliases.yaml
180
+ - desc/blank.yaml
181
+ - desc/ruby_version.yaml
182
+ - desc/regexp_visualize.yaml
183
+ - desc/sandbox.yaml
184
+ - desc/hash.yaml
185
+ - desc/kernel.yaml
165
186
  - Rakefile
166
187
  - zucker.gemspec
167
188
  - MIT-LICENSE
@@ -173,9 +194,9 @@ files:
173
194
  homepage: http://rubyzucker.info
174
195
  licenses:
175
196
  - MIT
176
- post_install_message: ! " ┌── info ────────────────┐\n J-_-L │ http://rubyzucker.info
177
- │\n ├── usage ───────────────┤\n │ require 'zucker/all' │\n
178
- # or │\n │ require 'zucker/<name> │\n └────────────────────────┘"
197
+ post_install_message: ! " ┌── info ──────────────────┐\n J-_-L │ http://rubyzucker.info
198
+ \ │\n ├── usage ─────────────────┤\n │ require 'zucker/default' │\n
199
+ \ │ # or │\n │ require 'zucker/<name> │\n └──────────────────────────┘"
179
200
  rdoc_options: []
180
201
  require_paths:
181
202
  - lib
@@ -191,10 +212,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
212
  - - ! '>='
192
213
  - !ruby/object:Gem::Version
193
214
  version: '0'
215
+ segments:
216
+ - 0
217
+ hash: -2165358313771987823
194
218
  requirements: []
195
219
  rubyforge_project:
196
- rubygems_version: 1.8.11
220
+ rubygems_version: 1.8.25
197
221
  signing_key:
198
222
  specification_version: 3
199
- summary: Many little helpers that sweeten your Ruby code :).
223
+ summary: Many little helpers that sweeten your Ruby code.
200
224
  test_files: []