Class: Quby::Answers::Services::BuildAnswer

Inherits:
Object
  • Object
show all
Defined in:
lib/quby/answers/services/build_answer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(questionnaire, given_attributes) ⇒ BuildAnswer

Returns a new instance of BuildAnswer.



10
11
12
13
# File 'lib/quby/answers/services/build_answer.rb', line 10

def initialize(questionnaire, given_attributes)
  @questionnaire = questionnaire
  @given_attributes = given_attributes.with_indifferent_access
end

Instance Attribute Details

#given_attributesObject (readonly)

Returns the value of attribute given_attributes.



8
9
10
# File 'lib/quby/answers/services/build_answer.rb', line 8

def given_attributes
  @given_attributes
end

#questionnaireObject (readonly)

Returns the value of attribute questionnaire.



7
8
9
# File 'lib/quby/answers/services/build_answer.rb', line 7

def questionnaire
  @questionnaire
end

Instance Method Details

#buildObject



15
16
17
# File 'lib/quby/answers/services/build_answer.rb', line 15

def build
  Quby::Answers::Entities::Answer.new(**attributes)
end