sc-core-ext 1.2.0 → 1.2.1
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.
- data/.document +5 -0
- data/.gitignore +24 -0
- data/History.txt +1 -5
- data/LICENSE +20 -0
- data/README.rdoc +14 -21
- data/Rakefile +51 -50
- data/VERSION +1 -0
- data/lib/sc-core-ext/float.rb +11 -7
- data/spec/sc-core-ext/active_support/ordered_hash_spec.rb +8 -1
- data/spec/spec_helper.rb +2 -1
- metadata +31 -30
data/.document
ADDED
data/.gitignore
ADDED
data/History.txt
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Colin MacKenzie IV
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -11,31 +11,24 @@ requiring this as a dependency.
|
|
11
11
|
|
12
12
|
* ActiveSupport 2.3.5+
|
13
13
|
|
14
|
-
==
|
14
|
+
== RAILS 3 COMPATIBILITY:
|
15
15
|
|
16
|
-
|
16
|
+
This library has passed its tests with ActiveSupport 3.0.0.beta4.
|
17
17
|
|
18
|
-
==
|
18
|
+
== INSTALL:
|
19
19
|
|
20
|
-
|
20
|
+
* sudo gem install sc-core-ext
|
21
21
|
|
22
|
-
|
22
|
+
== Note on Patches/Pull Requests
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
* Fork the project.
|
25
|
+
* Make your feature addition or bug fix.
|
26
|
+
* Add tests for it. This is important so I don't break it in a
|
27
|
+
future version unintentionally.
|
28
|
+
* Commit, do not mess with rakefile, version, or history.
|
29
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
30
|
+
* Send me a pull request. Bonus points for topic branches.
|
31
31
|
|
32
|
-
|
33
|
-
included in all copies or substantial portions of the Software.
|
32
|
+
== Copyright
|
34
33
|
|
35
|
-
|
36
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
37
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
38
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
39
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
40
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
41
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
34
|
+
Copyright (c) 2010 Colin MacKenzie IV. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,50 +1,51 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'spec/rake/spectask'
|
4
|
+
|
5
|
+
def rcov_opts
|
6
|
+
IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
7
|
+
end
|
8
|
+
|
9
|
+
begin
|
10
|
+
require 'jeweler'
|
11
|
+
Jeweler::Tasks.new do |gem|
|
12
|
+
gem.name = "sc-core-ext"
|
13
|
+
gem.summary = %Q{A collection of core extensions that I have come to rely on in more than one package}
|
14
|
+
gem.description = %Q{A collection of core extensions that I have come to rely on in more than one package}
|
15
|
+
gem.email = "sinisterchipmunk@gmail.com"
|
16
|
+
gem.homepage = "http://github.com/sinisterchipmunk/sc-core-ext"
|
17
|
+
gem.authors = ["Colin MacKenzie IV"]
|
18
|
+
gem.add_dependency 'activesupport', '>= 2.3.5'
|
19
|
+
gem.add_development_dependency 'rspec', '>=1.3.0'
|
20
|
+
gem.add_development_dependency 'rcov', '>=0.9.8'
|
21
|
+
end
|
22
|
+
Jeweler::GemcutterTasks.new
|
23
|
+
rescue LoadError
|
24
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
25
|
+
end
|
26
|
+
|
27
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
28
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
29
|
+
t.spec_opts = ['--options', 'spec/spec.opts']
|
30
|
+
t.rcov = false
|
31
|
+
end
|
32
|
+
|
33
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
34
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
35
|
+
t.spec_opts = ['--options', 'spec/spec.opts']
|
36
|
+
t.rcov = true
|
37
|
+
t.rcov_dir = 'coverage'
|
38
|
+
t.rcov_opts = rcov_opts
|
39
|
+
end
|
40
|
+
|
41
|
+
task :default => [:check_dependencies, :spec]
|
42
|
+
|
43
|
+
require 'rake/rdoctask'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
+
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = "sc-core-ext #{version}"
|
49
|
+
rdoc.rdoc_files.include('README*')
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.2.1
|
data/lib/sc-core-ext/float.rb
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
class Float
|
2
2
|
def to_frac
|
3
3
|
fraction = case self.abs%1.0
|
4
|
-
when 0
|
5
|
-
when 0.25
|
6
|
-
when 0.5
|
7
|
-
when 0.75
|
4
|
+
when 0 then ''
|
5
|
+
when 0.25 then '¼'
|
6
|
+
when 0.5 then '½'
|
7
|
+
when 0.75 then '¾'
|
8
8
|
end
|
9
9
|
if fraction
|
10
10
|
body = case self.floor
|
11
|
-
when -1
|
12
|
-
when 0
|
11
|
+
when -1 then '-'
|
12
|
+
when 0 then ''
|
13
13
|
else self.to_i.to_s
|
14
14
|
end
|
15
15
|
body + fraction
|
16
16
|
else
|
17
|
-
self.
|
17
|
+
if self % 1.0 == 0
|
18
|
+
self.to_i.to_s
|
19
|
+
else
|
20
|
+
self.to_s
|
21
|
+
end
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'active_support/version'
|
2
3
|
|
3
4
|
describe ActiveSupport::OrderedHash do
|
4
5
|
context "#to_yaml" do
|
@@ -10,7 +11,13 @@ describe ActiveSupport::OrderedHash do
|
|
10
11
|
end
|
11
12
|
|
12
13
|
it "converts to yaml" do
|
13
|
-
|
14
|
+
if ActiveSupport::VERSION::MAJOR >= 3 || RUBY_VERSION > "1.8"
|
15
|
+
yml = "--- !omap \n- :one: 1\n- :two: 2\n"
|
16
|
+
else
|
17
|
+
yml = "--- !map:ActiveSupport::OrderedHash \n:one: 1\n:two: 2\n"
|
18
|
+
end
|
19
|
+
|
20
|
+
subject.to_yaml.should == yml
|
14
21
|
end
|
15
22
|
end
|
16
23
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
$LOAD_PATH << File.expand_path("../..", __FILE__)
|
2
|
+
require 'lib/sc-core-ext'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 1.2.
|
8
|
+
- 1
|
9
|
+
version: 1.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Colin MacKenzie IV
|
@@ -14,13 +14,14 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-25 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activesupport
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - ">="
|
26
27
|
- !ruby/object:Gem::Version
|
@@ -35,6 +36,7 @@ dependencies:
|
|
35
36
|
name: rspec
|
36
37
|
prerelease: false
|
37
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
38
40
|
requirements:
|
39
41
|
- - ">="
|
40
42
|
- !ruby/object:Gem::Version
|
@@ -49,6 +51,7 @@ dependencies:
|
|
49
51
|
name: rcov
|
50
52
|
prerelease: false
|
51
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
52
55
|
requirements:
|
53
56
|
- - ">="
|
54
57
|
- !ruby/object:Gem::Version
|
@@ -59,37 +62,25 @@ dependencies:
|
|
59
62
|
version: 0.9.8
|
60
63
|
type: :development
|
61
64
|
version_requirements: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: hoe
|
64
|
-
prerelease: false
|
65
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
segments:
|
70
|
-
- 2
|
71
|
-
- 5
|
72
|
-
- 0
|
73
|
-
version: 2.5.0
|
74
|
-
type: :development
|
75
|
-
version_requirements: *id004
|
76
65
|
description: A collection of core extensions that I have come to rely on in more than one package
|
77
|
-
email:
|
78
|
-
- sinisterchipmunk@gmail.com
|
66
|
+
email: sinisterchipmunk@gmail.com
|
79
67
|
executables: []
|
80
68
|
|
81
69
|
extensions: []
|
82
70
|
|
83
71
|
extra_rdoc_files:
|
84
|
-
-
|
85
|
-
-
|
86
|
-
- PostInstall.txt
|
72
|
+
- LICENSE
|
73
|
+
- README.rdoc
|
87
74
|
files:
|
75
|
+
- .document
|
76
|
+
- .gitignore
|
88
77
|
- History.txt
|
78
|
+
- LICENSE
|
89
79
|
- Manifest.txt
|
90
80
|
- PostInstall.txt
|
91
81
|
- README.rdoc
|
92
82
|
- Rakefile
|
83
|
+
- VERSION
|
93
84
|
- lib/sc-core-ext.rb
|
94
85
|
- lib/sc-core-ext/active_support/ordered_hash.rb
|
95
86
|
- lib/sc-core-ext/array.rb
|
@@ -117,16 +108,16 @@ files:
|
|
117
108
|
- spec/spec.opts
|
118
109
|
- spec/spec_helper.rb
|
119
110
|
has_rdoc: true
|
120
|
-
homepage: http://github.com/sinisterchipmunk/core-ext
|
111
|
+
homepage: http://github.com/sinisterchipmunk/sc-core-ext
|
121
112
|
licenses: []
|
122
113
|
|
123
114
|
post_install_message:
|
124
115
|
rdoc_options:
|
125
|
-
- --
|
126
|
-
- README.rdoc
|
116
|
+
- --charset=UTF-8
|
127
117
|
require_paths:
|
128
118
|
- lib
|
129
119
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
130
121
|
requirements:
|
131
122
|
- - ">="
|
132
123
|
- !ruby/object:Gem::Version
|
@@ -134,6 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
125
|
- 0
|
135
126
|
version: "0"
|
136
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
137
129
|
requirements:
|
138
130
|
- - ">="
|
139
131
|
- !ruby/object:Gem::Version
|
@@ -142,10 +134,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
134
|
version: "0"
|
143
135
|
requirements: []
|
144
136
|
|
145
|
-
rubyforge_project:
|
146
|
-
rubygems_version: 1.3.
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 1.3.7
|
147
139
|
signing_key:
|
148
140
|
specification_version: 3
|
149
|
-
summary: A collection of core extensions
|
150
|
-
test_files:
|
151
|
-
|
141
|
+
summary: A collection of core extensions that I have come to rely on in more than one package
|
142
|
+
test_files:
|
143
|
+
- spec/sc-core-ext/active_support/ordered_hash_spec.rb
|
144
|
+
- spec/sc-core-ext/array_spec.rb
|
145
|
+
- spec/sc-core-ext/date_time_spec.rb
|
146
|
+
- spec/sc-core-ext/float_spec.rb
|
147
|
+
- spec/sc-core-ext/hash_spec.rb
|
148
|
+
- spec/sc-core-ext/numeric_spec.rb
|
149
|
+
- spec/sc-core-ext/object_spec.rb
|
150
|
+
- spec/sc-core-ext/regexp_spec.rb
|
151
|
+
- spec/sc-core-ext/string_spec.rb
|
152
|
+
- spec/spec_helper.rb
|