Class: Quby::Questionnaires::Entities::Textvar

Inherits:
Struct
  • Object
show all
Defined in:
lib/quby/questionnaires/entities/textvar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, description:, default: nil, depends_on_flag: nil) ⇒ Textvar

rubocop:disable ParameterLists



8
9
10
11
# File 'lib/quby/questionnaires/entities/textvar.rb', line 8

def initialize(key:, description:, default: nil, depends_on_flag: nil)
  default = "{{#{key}}}" unless default
  super(key, description, default, depends_on_flag)
end

Instance Attribute Details

#defaultObject

Returns the value of attribute default

Returns:

  • (Object)

    the current value of default



6
7
8
# File 'lib/quby/questionnaires/entities/textvar.rb', line 6

def default
  @default
end

#depends_on_flagObject

Returns the value of attribute depends_on_flag

Returns:

  • (Object)

    the current value of depends_on_flag



6
7
8
# File 'lib/quby/questionnaires/entities/textvar.rb', line 6

def depends_on_flag
  @depends_on_flag
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



6
7
8
# File 'lib/quby/questionnaires/entities/textvar.rb', line 6

def description
  @description
end

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



6
7
8
# File 'lib/quby/questionnaires/entities/textvar.rb', line 6

def key
  @key
end

Instance Method Details

#to_codebook(_options = {}) ⇒ Object

rubocop:enable ParameterLists



14
15
16
17
18
19
# File 'lib/quby/questionnaires/entities/textvar.rb', line 14

def to_codebook(_options = {})
  output = []
  output << "#{key} Textvariabele"
  output << description
  output.join("\n")
end