forked from Fosome/garb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
monkey patch array to support wrap so we can have filters like: [{:pa…
…ge_path.contains => 'NYC'}, [{:city.eql => 'New York City'}, {:state.eql => 'New York'}]] which prevents us from using flatten; move support stuff around and into core_ext and namespace to Garb, do not use AS constant in our extensions even though it duplicates that code
- Loading branch information
Showing
7 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,4 +86,4 @@ def symbol_operator_slugs | |
# probably just support open_timeout | ||
end | ||
|
||
require 'support' | ||
require 'garb/support' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
unless Object.const_defined?("ActiveSupport") | ||
puts "Array extension." | ||
class Array | ||
def self.wrap(object) | ||
if object.nil? | ||
[] | ||
elsif object.respond_to?(:to_ary) | ||
object.to_ary | ||
else | ||
[object] | ||
end | ||
end | ||
end | ||
else | ||
puts "ActiveSupport is suddenly defined!" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
unless Object.const_defined?("ActiveSupport") | ||
require File.expand_path("core_ext/string", File.dirname(__FILE__)) | ||
require File.expand_path("core_ext/array", File.dirname(__FILE__)) | ||
end | ||
|
||
require File.expand_path("core_ext/symbol", File.dirname(__FILE__)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters