Class: Idhja22::Dataset::Example
- Defined in:
- lib/idhja22/dataset/datum.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
Attributes inherited from Datum
#attribute_labels, #attributes, #category_label
Instance Method Summary collapse
-
#initialize(row, attr_labels, category_label) ⇒ Example
constructor
A new instance of Example.
- #to_a ⇒ Object
Methods inherited from Datum
Constructor Details
#initialize(row, attr_labels, category_label) ⇒ Example
Returns a new instance of Example.
29 30 31 32 33 |
# File 'lib/idhja22/dataset/datum.rb', line 29 def initialize(row, attr_labels, category_label) super self.category = self.attributes.pop raise UnknownCategoryValue, "Unrecognised category: #{@category} - should be Y or N" unless ['Y', 'N'].include?(@category) end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
27 28 29 |
# File 'lib/idhja22/dataset/datum.rb', line 27 def category @category end |
Instance Method Details
#to_a ⇒ Object
35 36 37 |
# File 'lib/idhja22/dataset/datum.rb', line 35 def to_a super+[category] end |