Class: AskAwesomely::Choice

Inherits:
Object
  • Object
show all
Includes:
JsonBuilder
Defined in:
lib/ask_awesomely/choice.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from JsonBuilder

#build_json

Constructor Details

#initialize(label:, picture: nil) ⇒ Choice

Returns a new instance of Choice.



8
9
10
11
12
13
14
15
16
# File 'lib/ask_awesomely/choice.rb', line 8

def initialize(label:, picture: nil)
  @state = OpenStruct.new(
    label: label,
  )

  if picture
    @state.image_id = proc { Picture.new(picture).typeform_id }
  end
end

Instance Attribute Details

#stateObject (readonly)

Returns the value of attribute state.



6
7
8
# File 'lib/ask_awesomely/choice.rb', line 6

def state
  @state
end