Skip to content

Commit

Permalink
Remove CSV view context and helpers (#804)
Browse files Browse the repository at this point in the history
Closes #803
  • Loading branch information
joeldrapper authored Oct 3, 2024
1 parent 85fc0f2 commit 7f166d7
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/phlex/csv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ def initialize(collection)
@_headers = []
@_current_row = []
@_current_column_index = 0
@_view_context = nil
@_first = true
end

attr_reader :collection

def call(buffer = +"", view_context: nil)
def call(buffer = +"", context: nil)
unless escape_csv_injection? == true || escape_csv_injection? == false
raise <<~MESSAGE
You need to define escape_csv_injection? in #{self.class.name}, returning either `true` or `false`.
Expand All @@ -40,8 +39,6 @@ def escape_csv_injection? = true
MESSAGE
end

@_view_context = view_context

each_item do |record|
yielder(record) do |*args, **kwargs|
view_template(*args, **kwargs)
Expand Down Expand Up @@ -105,10 +102,6 @@ def escape_csv_injection?
nil
end

def helpers
@_view_context
end

def __escape__(value)
value = trim_whitespace? ? value.to_s.strip : value.to_s
first_char = value[0]
Expand Down

0 comments on commit 7f166d7

Please sign in to comment.