upoj-rb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source "http://rubygems.org"
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
6
  gem 'paint'
7
+ gem 'active_support', '>= 2'
7
8
 
8
9
  # Add dependencies to develop your gem here.
9
10
  # Include everything needed to run rake, tests, features, etc.
data/Gemfile.lock CHANGED
@@ -1,6 +1,9 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ active_support (3.0.0)
5
+ activesupport (= 3.0.0)
6
+ activesupport (3.0.0)
4
7
  diff-lcs (1.1.3)
5
8
  gemcutter (0.7.0)
6
9
  git (1.2.5)
@@ -25,6 +28,7 @@ PLATFORMS
25
28
  ruby
26
29
 
27
30
  DEPENDENCIES
31
+ active_support (>= 2)
28
32
  bundler (~> 1.0.0)
29
33
  gemcutter
30
34
  jeweler (~> 1.6.4)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/lib/upoj-rb.rb CHANGED
@@ -1,5 +1,10 @@
1
+ require 'active_support/core_ext/array/extract_options'
2
+ require 'active_support/core_ext/hash/indifferent_access'
3
+ require 'active_support/core_ext/object/blank'
4
+ require 'active_support/core_ext/object/try'
5
+
1
6
  module Upoj
2
7
 
3
8
  end
4
9
 
5
- %w( ext opts signals ).each{ |dep| require File.join(File.dirname(__FILE__), 'upoj-rb', dep) }
10
+ %w( opts signals ).each{ |dep| require File.join(File.dirname(__FILE__), 'upoj-rb', dep) }
data/upoj-rb.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "upoj-rb"
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["AlphaHydrae"]
@@ -27,7 +27,6 @@ Gem::Specification.new do |s|
27
27
  "Rakefile",
28
28
  "VERSION",
29
29
  "lib/upoj-rb.rb",
30
- "lib/upoj-rb/ext.rb",
31
30
  "lib/upoj-rb/opts.rb",
32
31
  "lib/upoj-rb/signals.rb",
33
32
  "spec/blank_spec.rb",
@@ -47,6 +46,7 @@ Gem::Specification.new do |s|
47
46
 
48
47
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
48
  s.add_runtime_dependency(%q<paint>, [">= 0"])
49
+ s.add_runtime_dependency(%q<active_support>, [">= 2"])
50
50
  s.add_development_dependency(%q<rspec>, [">= 0"])
51
51
  s.add_development_dependency(%q<shoulda>, [">= 0"])
52
52
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
@@ -55,6 +55,7 @@ Gem::Specification.new do |s|
55
55
  s.add_development_dependency(%q<rdoc>, [">= 0"])
56
56
  else
57
57
  s.add_dependency(%q<paint>, [">= 0"])
58
+ s.add_dependency(%q<active_support>, [">= 2"])
58
59
  s.add_dependency(%q<rspec>, [">= 0"])
59
60
  s.add_dependency(%q<shoulda>, [">= 0"])
60
61
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
@@ -64,6 +65,7 @@ Gem::Specification.new do |s|
64
65
  end
65
66
  else
66
67
  s.add_dependency(%q<paint>, [">= 0"])
68
+ s.add_dependency(%q<active_support>, [">= 2"])
67
69
  s.add_dependency(%q<rspec>, [">= 0"])
68
70
  s.add_dependency(%q<shoulda>, [">= 0"])
69
71
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upoj-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: paint
16
- requirement: &2156246260 !ruby/object:Gem::Requirement
16
+ requirement: &2158184980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156246260
24
+ version_requirements: *2158184980
25
+ - !ruby/object:Gem::Dependency
26
+ name: active_support
27
+ requirement: &2158184440 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '2'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *2158184440
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: rspec
27
- requirement: &2156244680 !ruby/object:Gem::Requirement
38
+ requirement: &2158183940 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,10 +43,10 @@ dependencies:
32
43
  version: '0'
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *2156244680
46
+ version_requirements: *2158183940
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: shoulda
38
- requirement: &2156243180 !ruby/object:Gem::Requirement
49
+ requirement: &2158183440 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ! '>='
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: '0'
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *2156243180
57
+ version_requirements: *2158183440
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: bundler
49
- requirement: &2156242180 !ruby/object:Gem::Requirement
60
+ requirement: &2158182900 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ~>
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: 1.0.0
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *2156242180
68
+ version_requirements: *2158182900
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: jeweler
60
- requirement: &2156241300 !ruby/object:Gem::Requirement
71
+ requirement: &2158182420 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ~>
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: 1.6.4
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *2156241300
79
+ version_requirements: *2158182420
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: gemcutter
71
- requirement: &2156239520 !ruby/object:Gem::Requirement
82
+ requirement: &2158181920 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: '0'
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *2156239520
90
+ version_requirements: *2158181920
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: rdoc
82
- requirement: &2156238460 !ruby/object:Gem::Requirement
93
+ requirement: &2158181440 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ! '>='
@@ -87,7 +98,7 @@ dependencies:
87
98
  version: '0'
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *2156238460
101
+ version_requirements: *2158181440
91
102
  description: This contains common ruby extensions mostly taken from Rails, as well
92
103
  as various command-line utilities.
93
104
  email: hydrae.alpha@gmail.com
@@ -107,7 +118,6 @@ files:
107
118
  - Rakefile
108
119
  - VERSION
109
120
  - lib/upoj-rb.rb
110
- - lib/upoj-rb/ext.rb
111
121
  - lib/upoj-rb/opts.rb
112
122
  - lib/upoj-rb/signals.rb
113
123
  - spec/blank_spec.rb
@@ -130,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
140
  version: '0'
131
141
  segments:
132
142
  - 0
133
- hash: 2937755540580952162
143
+ hash: 725755434624582504
134
144
  required_rubygems_version: !ruby/object:Gem::Requirement
135
145
  none: false
136
146
  requirements:
data/lib/upoj-rb/ext.rb DELETED
@@ -1,75 +0,0 @@
1
- class Object
2
-
3
- # An object is blank if it's false, empty, or a whitespace string. For
4
- # example, "", " ", nil, [], and {} are blank.
5
- #
6
- # This simplifies:
7
- #
8
- # if !address.nil? && !address.empty?
9
- # ... to:
10
- #
11
- # if !address.blank?
12
- def blank?
13
- !self or (respond_to?(:empty?) and empty?)
14
- end
15
-
16
- # An object is present if it's not blank.
17
- def present?
18
- !blank?
19
- end
20
-
21
- # Invokes the method identified by the symbol method, passing it any
22
- # arguments and/or the block specified, just like the regular Ruby Object#send does.
23
- #
24
- # Unlike that method however, a NoMethodError exception will not be
25
- # raised and nil will be returned instead, if the receiving object is
26
- # a nil object or NilClass.
27
- #
28
- # ==== Examples
29
- # Without try
30
- # @person && @person.name
31
- # or
32
- # @person ? @person.name : nil
33
- # With try
34
- # @person.try(:name)
35
- #
36
- # try also accepts arguments and/or a block, for the method it is trying
37
- # hash.try :[], key
38
- # array.try(:collect){ |e| e.reverse }
39
- def try method, *args, &block
40
- nil? ? nil : send(method, *args, &block)
41
- end
42
- end
43
-
44
- class String
45
-
46
- # Astring is blank if it's empty or a whitespace string.
47
- # For example, "" and " " are blank.
48
- def blank?
49
- self !~ /\S/
50
- end
51
- end
52
-
53
- class Array
54
-
55
- # Extracts options from a set of arguments. Removes and returns the
56
- # last element in the array if it's a hash, otherwise returns a blank hash.
57
- def extract_options!
58
- if last.kind_of?(Hash) and last.extractable_options?
59
- pop
60
- else
61
- {}
62
- end
63
- end
64
- end
65
-
66
- class Hash
67
-
68
- # By default, only instances of Hash itself are extractable. Subclasses
69
- # of Hash may implement this method and return true to declare themselves
70
- # as extractable. If a Hash is extractable, Array#extract_options! pops it
71
- # from the Array when it is the last element of the Array.
72
- def extractable_options?
73
- instance_of?(Hash)
74
- end
75
- end