Class: OpenAmplify::Analysis::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/openamplify/analysis/context.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
OpenAmplify::Configuration::VALID_OPTIONS_KEYS + [:input]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, input, options) ⇒ Context

Returns a new instance of Context.



13
14
15
16
17
18
19
20
21
# File 'lib/openamplify/analysis/context.rb', line 13

def initialize(client, input, options)
  self.client = client
  self.input  = input

  merged_options = OpenAmplify.options.merge(options)
  OpenAmplify::Configuration::VALID_OPTIONS_KEYS.each do |key|
    send("#{key}=", merged_options[key])
  end
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



10
11
12
# File 'lib/openamplify/analysis/context.rb', line 10

def client
  @client
end

Instance Method Details

#empty?Boolean

The empty?, to_s, to_str are to make our object play with others that expect a string.

Example, you can do this:

puts result

instead of:

puts result.to_s

Returns:

  • (Boolean)


32
33
34
# File 'lib/openamplify/analysis/context.rb', line 32

def empty?
  result.empty?
end

#to_sObject Also known as: to_str



36
37
38
# File 'lib/openamplify/analysis/context.rb', line 36

def to_s
  "#{result}"
end