-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
29 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
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 |
---|---|---|
@@ -1,24 +1,43 @@ | ||
class FilestackVersion | ||
def initialize(results) | ||
@version = ::Rails.application.config.filestack_rails.version | ||
@results = results | ||
end | ||
|
||
def determine_filestack_js_result | ||
begin | ||
@results[@version.to_sym].call | ||
rescue | ||
raise 'Set correct version in config.filestack_rails.version' | ||
end | ||
end | ||
end | ||
|
||
module FilestackRails | ||
VERSION = '4.0.7' | ||
|
||
module Version | ||
def get_filestack_js_result(results) | ||
FilestackVersion.new(results).determine_filestack_js_result | ||
module FilestackJs | ||
VERSION_0 = '0.11.5' | ||
|
||
VERSION_1_2_3 = [ | ||
'1.x.x', '1.0.0', '1.0.1', '1.0.2', '1.1.0', '1.2.0', '1.2.1', '1.3.0', | ||
'1.3.1', '1.3.2', '1.4.0', '1.5.0', '1.5.1', '1.6.0', '1.6.1', '1.7.0', | ||
'1.7.1', '1.7.2', '1.7.3', '1.7.4', '1.7.5', '1.7.6', '1.7.7', '1.8.0', | ||
'1.8.1', '1.8.2', '1.8.3', '1.9.0', '1.10.0', '1.11.0', '1.12.0', | ||
'1.12.1', '1.13.0', '1.13.1', '1.13.2', '1.13.3', '1.14.0', '1.14.1', | ||
'1.14.2', '1.14.3', '1.14.4', '1.14.5', '1.14.6', | ||
|
||
'2.x.x', '2.0.0', '2.0.1', '2.0.2', '2.0.3', '2.0.4', '2.0.5', '2.0.6', | ||
'2.0.7', '2.1.0', | ||
|
||
'3.x.x', '3.0.0', '3.1.0', '3.1.1', '3.2.0', '3.3.0', '3.3.1', '3.3.2', | ||
'3.3.3', '3.3.4', '3.3.5', '3.4.0', '3.4.1', '3.4.2', '3.5.0' | ||
] | ||
|
||
ALL_VERSIONS = [ | ||
VERSION_0, | ||
VERSION_1_2_3 | ||
] | ||
|
||
def determine_filestack_js_result(results) | ||
version = ::Rails.application.config.filestack_rails.version | ||
|
||
begin | ||
sym = case | ||
when VERSION_0.include?(version); :version_0 | ||
when VERSION_1_2_3.include?(version); :version_1_2_3 | ||
else nil | ||
end | ||
|
||
results[sym].call | ||
rescue | ||
raise | ||
end | ||
end | ||
end | ||
end |