class CloudscrapeClient::Executions::Result

Attributes

row[R]

Public Class Methods

new(headers:, row:) click to toggle source
# File lib/cloudscrape_client/executions/result.rb, line 10
def initialize(headers:, row:)
  @headers = headers
  @row = row
  build
end

Public Instance Methods

as_hash() click to toggle source
# File lib/cloudscrape_client/executions/result.rb, line 20
def as_hash
  @as_hash ||= Hash[@headers.zip(row)]
end
build() click to toggle source
# File lib/cloudscrape_client/executions/result.rb, line 16
def build
  as_hash.each(&define_method_for_header)
end

Private Instance Methods

define_method_for_header() click to toggle source
# File lib/cloudscrape_client/executions/result.rb, line 26
def define_method_for_header
  lambda do |key, value|
    self.class.send(:define_method, key) do
      value.to_s.include?(File::FILE_KEYWORD) ? File.new(value) : value
    end
  end
end