Class: TFClient::Models::ModelWithItems
- Inherits:
-
Model
- Object
- Model
- TFClient::Models::ModelWithItems
show all
- Defined in:
- lib/textflight-client/models/model.rb
Instance Attribute Summary collapse
Attributes inherited from Model
#label, #translation, #values_hash
Instance Method Summary
collapse
Methods inherited from Model
#initialize
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items.
32
33
34
|
# File 'lib/textflight-client/models/model.rb', line 32
def items
@items
end
|
Instance Method Details
#count ⇒ Object
34
35
36
|
# File 'lib/textflight-client/models/model.rb', line 34
def count
@items.count
end
|
#items_to_s ⇒ Object
42
43
44
|
# File 'lib/textflight-client/models/model.rb', line 42
def items_to_s
@items.map { |item| "\t#{item[:string]}" }
end
|
#lines_offset ⇒ Object
50
51
52
|
# File 'lib/textflight-client/models/model.rb', line 50
def lines_offset
@items.length + 1
end
|
#response_str ⇒ Object
46
47
48
|
# File 'lib/textflight-client/models/model.rb', line 46
def response_str
"#{@translation}:\n#{items_to_s.join("\n")}"
end
|
#to_s ⇒ Object
38
39
40
|
# File 'lib/textflight-client/models/model.rb', line 38
def to_s
"#{@translation}: #{@items.map { |item| item[:string]}}"
end
|