sugar_refinery 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +157 -0
  3. data/MIT-LICENSE.txt +20 -0
  4. data/README.md +42 -0
  5. data/Rakefile +49 -0
  6. data/doc/create_documentation.rb +471 -0
  7. data/doc/index.html +1687 -0
  8. data/lib/sugar_refinery.rb +1 -0
  9. data/lib/sugar_refinery/alias_for.rb +15 -0
  10. data/lib/sugar_refinery/all.rb +5 -0
  11. data/lib/sugar_refinery/array_op.rb +15 -0
  12. data/lib/sugar_refinery/array_stats.rb +31 -0
  13. data/lib/sugar_refinery/blank.rb +47 -0
  14. data/lib/sugar_refinery/camel_snake.rb +15 -0
  15. data/lib/sugar_refinery/chain_map.rb +11 -0
  16. data/lib/sugar_refinery/constantize.rb +29 -0
  17. data/lib/sugar_refinery/dir_utils.rb +20 -0
  18. data/lib/sugar_refinery/file_force_delete.rb +12 -0
  19. data/lib/sugar_refinery/file_gsub.rb +23 -0
  20. data/lib/sugar_refinery/hash_op.rb +28 -0
  21. data/lib/sugar_refinery/hash_zip.rb +11 -0
  22. data/lib/sugar_refinery/inner_map.rb +15 -0
  23. data/lib/sugar_refinery/lchomp.rb +15 -0
  24. data/lib/sugar_refinery/marshal_copy.rb +11 -0
  25. data/lib/sugar_refinery/mash.rb +22 -0
  26. data/lib/sugar_refinery/ords.rb +17 -0
  27. data/lib/sugar_refinery/regexp_union.rb +17 -0
  28. data/lib/sugar_refinery/same.rb +11 -0
  29. data/lib/sugar_refinery/string_op.rb +20 -0
  30. data/lib/sugar_refinery/version.rb +3 -0
  31. data/spec/alias_for_spec.rb +55 -0
  32. data/spec/array_op_spec.rb +17 -0
  33. data/spec/array_stats_spec.rb +82 -0
  34. data/spec/blank_spec.rb +22 -0
  35. data/spec/camel_snake_spec.rb +15 -0
  36. data/spec/chain_map_spec.rb +16 -0
  37. data/spec/constantize_spec.rb +33 -0
  38. data/spec/dir_utils_spec.rb +32 -0
  39. data/spec/file_force_delete_spec.rb +30 -0
  40. data/spec/file_gsub_spec.rb +26 -0
  41. data/spec/hash_op_spec.rb +28 -0
  42. data/spec/hash_zip_spec.rb +11 -0
  43. data/spec/inner_map_spec.rb +24 -0
  44. data/spec/lchomp_spec.rb +20 -0
  45. data/spec/marshal_copy_spec.rb +15 -0
  46. data/spec/mash_spec.rb +17 -0
  47. data/spec/ords_spec.rb +15 -0
  48. data/spec/regexp_union_spec.rb +19 -0
  49. data/spec/same_spec.rb +10 -0
  50. data/spec/spec_helper.rb +18 -0
  51. data/spec/string_op_spec.rb +22 -0
  52. data/sugar_refinery.gemspec +20 -0
  53. metadata +138 -0
@@ -0,0 +1,10 @@
1
+ require 'sugar_refinery/same'
2
+ using SugarRefinery::Same
3
+
4
+ describe Float do
5
+ describe '#same?' do
6
+ it 'returns true if other float represents the same number' do
7
+ expect( 0.3.same?(0.1 + 0.2) ).to be true
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ require 'stringio'
2
+
3
+ def capture_stdout
4
+ capture = StringIO.new
5
+ restore, $stdout = $stdout, capture
6
+ yield
7
+ $stdout = restore
8
+ capture.string
9
+ end
10
+
11
+ def capture_stderr
12
+ capture = StringIO.new
13
+ restore, $stderr = $stderr, capture
14
+ yield
15
+ $stderr = restore
16
+ capture.string
17
+ end
18
+
@@ -0,0 +1,22 @@
1
+ require 'sugar_refinery/string_op'
2
+ using SugarRefinery::StringOp
3
+
4
+
5
+ describe 'String#-' do
6
+ it 'should remove the applied Regexp or String from self via gsub' do
7
+ ('1234abc5678' - 'b' - /\d/).should == 'ac'
8
+ end
9
+ end
10
+
11
+ describe 'String#^' do
12
+ it 'should give C-like substring access to strings' do
13
+ string = 'Theoretische Informatik ist voll geil!'
14
+
15
+ (string^0).should == 'Theoretische Informatik ist voll geil!'
16
+ (string^1).should == 'heoretische Informatik ist voll geil!'
17
+ (string^13).should == 'Informatik ist voll geil!'
18
+ (string^-1).should == 'Theoretische Informatik ist voll geil'
19
+ (string^38).should == ''
20
+ (string^99).should == nil
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+ require File.dirname(__FILE__) + '/lib/sugar_refinery/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "sugar_refinery"
6
+ s.version = SugarRefinery::VERSION
7
+ s.authors = ['Jan Lelis']
8
+ s.email = ['mail@janlelis.de']
9
+ s.summary = "The Ruby Sugar Refinery is a collection of tiny refinements."
10
+ s.description = "The Ruby Sugar Refinery is a collection of tiny refinements (declarative local core extensions)."
11
+ s.homepage = "http://janlelis.github.io/sugar_refinery"
12
+ s.files = Dir.glob( %w[{lib,spec}/**/*.rb desc/**/*.yaml] ) + %w{Rakefile sugar_refinery.gemspec MIT-LICENSE.txt README.md CHANGELOG.md doc/create_documentation.rb doc/index.html}
13
+ s.require_paths = ["lib"]
14
+ s.license = 'MIT'
15
+
16
+ s.required_ruby_version = '~> 2.0'
17
+ s.add_development_dependency 'rake', '~> 10.4'
18
+ s.add_development_dependency 'rspec', '~> 2.99'
19
+ s.add_development_dependency 'coderay', '~> 1.1'
20
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sugar_refinery
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jan Lelis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.4'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '10.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.99'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.99'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coderay
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.1'
55
+ description: The Ruby Sugar Refinery is a collection of tiny refinements (declarative
56
+ local core extensions).
57
+ email:
58
+ - mail@janlelis.de
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - CHANGELOG.md
64
+ - MIT-LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - doc/create_documentation.rb
68
+ - doc/index.html
69
+ - lib/sugar_refinery.rb
70
+ - lib/sugar_refinery/alias_for.rb
71
+ - lib/sugar_refinery/all.rb
72
+ - lib/sugar_refinery/array_op.rb
73
+ - lib/sugar_refinery/array_stats.rb
74
+ - lib/sugar_refinery/blank.rb
75
+ - lib/sugar_refinery/camel_snake.rb
76
+ - lib/sugar_refinery/chain_map.rb
77
+ - lib/sugar_refinery/constantize.rb
78
+ - lib/sugar_refinery/dir_utils.rb
79
+ - lib/sugar_refinery/file_force_delete.rb
80
+ - lib/sugar_refinery/file_gsub.rb
81
+ - lib/sugar_refinery/hash_op.rb
82
+ - lib/sugar_refinery/hash_zip.rb
83
+ - lib/sugar_refinery/inner_map.rb
84
+ - lib/sugar_refinery/lchomp.rb
85
+ - lib/sugar_refinery/marshal_copy.rb
86
+ - lib/sugar_refinery/mash.rb
87
+ - lib/sugar_refinery/ords.rb
88
+ - lib/sugar_refinery/regexp_union.rb
89
+ - lib/sugar_refinery/same.rb
90
+ - lib/sugar_refinery/string_op.rb
91
+ - lib/sugar_refinery/version.rb
92
+ - spec/alias_for_spec.rb
93
+ - spec/array_op_spec.rb
94
+ - spec/array_stats_spec.rb
95
+ - spec/blank_spec.rb
96
+ - spec/camel_snake_spec.rb
97
+ - spec/chain_map_spec.rb
98
+ - spec/constantize_spec.rb
99
+ - spec/dir_utils_spec.rb
100
+ - spec/file_force_delete_spec.rb
101
+ - spec/file_gsub_spec.rb
102
+ - spec/hash_op_spec.rb
103
+ - spec/hash_zip_spec.rb
104
+ - spec/inner_map_spec.rb
105
+ - spec/lchomp_spec.rb
106
+ - spec/marshal_copy_spec.rb
107
+ - spec/mash_spec.rb
108
+ - spec/ords_spec.rb
109
+ - spec/regexp_union_spec.rb
110
+ - spec/same_spec.rb
111
+ - spec/spec_helper.rb
112
+ - spec/string_op_spec.rb
113
+ - sugar_refinery.gemspec
114
+ homepage: http://janlelis.github.io/sugar_refinery
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: '2.0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.5.1
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: The Ruby Sugar Refinery is a collection of tiny refinements.
138
+ test_files: []