Skip to content

Commit

Permalink
Require 'Date' in date_extensions.rb
Browse files Browse the repository at this point in the history
When calling gem from a little command-line script, I was getting the
following error:
```
~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/tod-2.0.2/lib/tod/date_extensions.rb:15:in `<top (required)>': uninitialized constant Date (NameError)
	from /Users/ambirdsall/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Users/ambirdsall/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Users/ambirdsall/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/tod-2.0.2/lib/tod/core_extensions.rb:1:in `<top (required)>'
	from /Users/ambirdsall/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Users/ambirdsall/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
```

This adds an explicit `require 'Date'` to the offending file so that
this can be used outside of bundled environments where the `Date` class
is preloaded.
  • Loading branch information
ambirdsall committed May 8, 2016
1 parent 195bfb4 commit f421a7a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/tod/date_extensions.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'date'

module Tod
module DateExtensions
# Returns a local Time instance with this date and time_of_day
Expand Down

0 comments on commit f421a7a

Please sign in to comment.