hobo_support 2.0.0.pre10 → 2.0.0

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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.pre10
1
+ 2.0.0
@@ -13,7 +13,6 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.add_runtime_dependency('rails', ["~> 3.2.0"])
15
15
  s.add_development_dependency('rubydoctest', [">= 0"])
16
- s.add_development_dependency('chronic', [">= 0"])
17
16
 
18
17
  s.files = `git ls-files -x #{name}/* -z`.split("\0")
19
18
 
@@ -2,7 +2,6 @@ require 'active_support'
2
2
  require 'active_support/core_ext'
3
3
  require 'active_support/dependencies'
4
4
 
5
- require "hobo_support/fixes/chronic"
6
5
  require "hobo_support/fixes/pp"
7
6
  require "hobo_support/fixes/module"
8
7
  require 'hobo_support/blankslate'
@@ -16,7 +16,7 @@ module HoboSupport
16
16
  CallIfAvailable.new(this)
17
17
  else
18
18
  # activesupport 2.3 style try
19
- this.send(*args, &block)
19
+ this.send(:active_support_try, *args, &block)
20
20
  end
21
21
  end
22
22
 
@@ -46,6 +46,8 @@ class Object
46
46
  self
47
47
  end
48
48
 
49
+ alias_method :active_support_try, :try
50
+
49
51
  def try(*args, &block)
50
52
  HoboSupport.hobo_try(self, *args, &block)
51
53
  end
@@ -10,7 +10,6 @@ HoboSupport is a mixed bag of core ruby extensions that have been extracted from
10
10
 
11
11
  ## Contents
12
12
 
13
- * [Chronic](/manual/hobo_support/chronic)
14
13
  * [Enumerable](/manual/hobo_support/enumerable)
15
14
  * [Hash](/manual/hobo_support/hash)
16
15
  * [Implies](/manual/hobo_support/implies)
@@ -75,3 +74,14 @@ may use `try` to call a Rails 2.3 function that doesn't exist on Rails
75
74
  => 0
76
75
  >> nil._?.to_i
77
76
  => nil
77
+
78
+ ### ActiveSupport's try
79
+
80
+ `try` and `_?` were added to HoboSupport before `try` was added to ActiveSupport. Unfortunately, the try in ActiveSupport is different. It behaves in a fashion similar to HoboSupport's `_?`, but has a different signature:
81
+
82
+ >> nil.try(:foo)
83
+ => nil
84
+ >> nil.try {|p| "(not available"}
85
+ >> "(not available)"
86
+ >> "foo".try(:reverse)
87
+ >> "oof"
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobo_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre10
5
- prerelease: 6
4
+ version: 2.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tom Locke
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-20 00:00:00.000000000 Z
12
+ date: 2013-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -43,22 +43,6 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: chronic
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
46
  description: Core Ruby extensions from the Hobo project
63
47
  email: tom@tomlocke.com
64
48
  executables: []
@@ -87,7 +71,6 @@ files:
87
71
  - lib/hobo_support/command.rb
88
72
  - lib/hobo_support/common_tasks.rb
89
73
  - lib/hobo_support/enumerable.rb
90
- - lib/hobo_support/fixes/chronic.rb
91
74
  - lib/hobo_support/fixes/module.rb
92
75
  - lib/hobo_support/fixes/pp.rb
93
76
  - lib/hobo_support/hash.rb
@@ -100,7 +83,6 @@ files:
100
83
  - lib/hobo_support/string.rb
101
84
  - lib/hobo_support/xss.rb
102
85
  - test/hobosupport.rdoctest
103
- - test/hobosupport/chronic.rdoctest
104
86
  - test/hobosupport/enumerable.rdoctest
105
87
  - test/hobosupport/hash.rdoctest
106
88
  - test/hobosupport/implies.rdoctest
@@ -1,21 +0,0 @@
1
- # --- Fix Chronic - can't parse '12th Jan' --- #
2
- begin
3
- require 'chronic'
4
-
5
- module Chronic
6
-
7
- class << self
8
- def parse_with_hobo_fix(s, *options)
9
- if s =~ /^\s*\d+\s*(st|nd|rd|th)\s+[a-zA-Z]+(\s+\d+)?\s*$/
10
- s = s.sub(/\s*\d+(st|nd|rd|th)/) {|s| s[0..-3]}
11
- end
12
-
13
- # Chronic can't parse '1/1/2008 1:00' or '1/1/2008 1:00 PM',
14
- # so convert them to '1/1/2008 @ 1:00' and '1/1/2008 @ 1:00 PM'
15
- s = s.sub(/^\s*(\d+\/\d+\/\d+)\s+(\d+:\d+.*)/, '\1 @ \2')
16
- parse_without_hobo_fix(s, *options)
17
- end
18
- alias_method_chain :parse, :hobo_fix
19
- end
20
- end
21
- rescue LoadError; end
@@ -1,19 +0,0 @@
1
- # HoboSupport - Chronic extensions
2
-
3
- doctest_require: '../../lib/hobo_support'
4
- doctest_require: 'chronic'
5
- {.hidden}
6
-
7
- ## `Chronic.parse`
8
-
9
- Chronic.parse can't parse 'M/D/Y H:S', so convert it to 'M/D/Y @ H:S'.
10
-
11
- >> Chronic.parse('1/1/2008 1:00') == Chronic.parse('1/1/2008 @ 1:00')
12
-
13
- => true
14
-
15
- Chronic.parse takes additional options (see Chronic.parse).
16
-
17
- >> Chronic.parse('today', :guess => false).instance_of? Chronic::Span
18
-
19
- => true