Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #98 from socialcast/ruby-1.9.3
Browse files Browse the repository at this point in the history
Add ruby-1.9.3 compatibility
  • Loading branch information
mandrews committed Mar 17, 2015
2 parents 083d12a + 00c0443 commit 4333bd4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: ruby
rvm:
- 1.9.3
- 2.0.0
- 2.1.2
- 2.1.5
Expand Down
6 changes: 4 additions & 2 deletions lib/masamune/cached_filesystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ def stat(file_or_dir)
CACHE_DEPTH = 1
EMPTY_SET = Set.new

def glob_stat(file_or_glob, depth: 0, &block)
def glob_stat(file_or_glob, options = {}, &block)
return if file_or_glob.blank?
return if root_path?(file_or_glob)
depth = options.fetch(:depth, 0)
return if depth > MAX_DEPTH || depth > CACHE_DEPTH

glob_stat(dirname(file_or_glob), depth: depth + 1, &block)
Expand All @@ -97,7 +98,8 @@ def glob_stat(file_or_glob, depth: 0, &block)
end if depth == 0
end

def recursive_paths(root, path, depth: 0, &block)
def recursive_paths(root, path, options = {}, &block)
depth = options.fetch(:depth, 0)
return if depth > MAX_DEPTH
return if root == path
yield path
Expand Down
8 changes: 4 additions & 4 deletions lib/masamune/filesystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,12 @@ def mktempdir!(path)
end
end

def glob_split(input, recursive: false)
[ input.include?('*') ? input.split('*').first + '*' : input, glob_to_regexp(input, recursive: recursive) ]
def glob_split(input, options = {})
[ input.include?('*') ? input.split('*').first + '*' : input, glob_to_regexp(input, options) ]
end

def glob_to_regexp(input, recursive: false)
if input.include?('*') || recursive
def glob_to_regexp(input, options = {})
if input.include?('*') || options.fetch(:recursive, false)
%r|\A#{Regexp.escape(input).gsub('\\*', '.*?').gsub(%r{\/\.\*\?\z}, '/?.*?')}|
else
/\A#{Regexp.escape(input)}\z/
Expand Down
4 changes: 2 additions & 2 deletions lib/masamune/schema/column.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ def csv_value(value)
when :boolean
value ? 'TRUE' : 'FALSE'
when :yaml
value.to_h.to_yaml
value.to_hash.to_yaml
when :json, :key_value
value.to_h.to_json
value.to_hash.to_json
when :date
value.to_s
when :timestamp
Expand Down
6 changes: 3 additions & 3 deletions lib/masamune/transform/stage_dimension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def insert_values(source)
method_with_last_element :insert_values

def join_conditions(source)
join_columns = shared_columns(source).values.flatten.lazy
join_columns = join_columns.select { |column| column.reference }.lazy
join_columns = join_columns.group_by { |column| column.reference }.lazy
join_columns = shared_columns(source).values.flatten
join_columns = join_columns.select { |column| column.reference }
join_columns = join_columns.group_by { |column| column.reference }

conditions = Hash.new { |h,k| h[k] = Set.new }
join_columns.each do |reference, columns|
Expand Down
6 changes: 3 additions & 3 deletions lib/masamune/transform/stage_fact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def insert_values(source)
method_with_last_element :insert_values

def join_conditions(source)
join_columns = shared_columns(source).values.flatten.lazy
join_columns = join_columns.select { |column| column.reference }.lazy
join_columns = join_columns.group_by { |column| column.reference }.lazy
join_columns = shared_columns(source).values.flatten
join_columns = join_columns.select { |column| column.reference }
join_columns = join_columns.group_by { |column| column.reference }

dependencies = Masamune::TopologicalHash.new
conditions = Hash.new { |h,k| h[k] = [] }
Expand Down

0 comments on commit 4333bd4

Please sign in to comment.