Class: CloudscrapeClient::Executions::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudscrape_client/executions/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(headers:, row:) ⇒ Result

Returns a new instance of Result.



6
7
8
9
10
# File 'lib/cloudscrape_client/executions/result.rb', line 6

def initialize(headers:, row:)
  @headers = headers
  @row = row
  build
end

Instance Attribute Details

#rowObject (readonly)

Returns the value of attribute row.



4
5
6
# File 'lib/cloudscrape_client/executions/result.rb', line 4

def row
  @row
end

Instance Method Details

#as_hashObject



16
17
18
# File 'lib/cloudscrape_client/executions/result.rb', line 16

def as_hash
  @as_hash ||= Hash[@headers.zip(row)]
end

#buildObject



12
13
14
# File 'lib/cloudscrape_client/executions/result.rb', line 12

def build
  as_hash.each(&define_method_for_header)
end