Skip to content

Commit

Permalink
fixed bug which passed the wrong variable to Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
bytesource committed Jan 8, 2012
1 parent eafa419 commit ef2ebde
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/rstore/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class Data

def initialize path, content, state, options
error_message = "#{path}: The following options are not valid as an argument to #{self.class}:\n#{options}"
raise ArgumentError, error_message unless options.is_a?(Hash)
raise ArgumentError, error_message unless options.is_a?(Hash)
@path = path
@content = content
self.state = state
@options = options
end


#def extract_type path
# path, filename = File.split(path)
# filename.match(/\.(?<type>.*)$/)[:type].to_sym
Expand All @@ -41,9 +41,9 @@ def parse_csv

begin
csv = CSVWrapper.parse(@content, parse_options)
csv = csv.drop(1) if file_options[:has_headers] == true # drop the first row if it is a header
csv = csv.drop(1) if file_options[:has_headers] == true # drop the first row if it is a header
rescue => e
Logger.new(@options).print(@data.path, :parse, e)
Logger.new(@options).print(@path, :parse, e)
end

@state = :parsed
Expand All @@ -64,7 +64,7 @@ def into_db database, table_name


def state= state
error_message = "#{state.inspect} is not a valid state. The following states are valid: #{print_valid_states}"
error_message = "#{state.inspect} is not a valid state. The following states are valid: #{print_valid_states}"
raise ArgumentError, error_message unless KnownStates.include?(state)
@state = state
end
Expand All @@ -76,5 +76,5 @@ def print_valid_states
end

end
end
end

0 comments on commit ef2ebde

Please sign in to comment.