Class: Quarry::DataSet::Example
- Inherits:
-
Object
- Object
- Quarry::DataSet::Example
- Defined in:
- lib/quarry_rb/data_set/example.rb
Instance Attribute Summary collapse
-
#example ⇒ Object
readonly
Returns the value of attribute example.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #[]=(index, value) ⇒ Object
- #category ⇒ Object
- #category=(new_category) ⇒ Object
- #category_index ⇒ Object
-
#initialize(example, data_set) ⇒ Example
constructor
A new instance of Example.
Constructor Details
#initialize(example, data_set) ⇒ Example
Returns a new instance of Example.
6 7 8 9 |
# File 'lib/quarry_rb/data_set/example.rb', line 6 def initialize(example, data_set) @data_set = data_set @example = example end |
Instance Attribute Details
#example ⇒ Object (readonly)
Returns the value of attribute example.
4 5 6 |
# File 'lib/quarry_rb/data_set/example.rb', line 4 def example @example end |
Instance Method Details
#[](index) ⇒ Object
11 12 13 |
# File 'lib/quarry_rb/data_set/example.rb', line 11 def [](index) @example.get_value(index) end |
#[]=(index, value) ⇒ Object
15 16 17 |
# File 'lib/quarry_rb/data_set/example.rb', line 15 def []=(index, value) @example.set_value(index, value) end |
#category ⇒ Object
19 20 21 |
# File 'lib/quarry_rb/data_set/example.rb', line 19 def category @data_set.categories[@example.get_category_index] end |
#category=(new_category) ⇒ Object
27 28 29 |
# File 'lib/quarry_rb/data_set/example.rb', line 27 def category=(new_category) @example.set_category_index(@data_set.data_set, new_category) end |
#category_index ⇒ Object
23 24 25 |
# File 'lib/quarry_rb/data_set/example.rb', line 23 def category_index @example.get_category_index end |