Class: Quarry::DataSet::Example

Inherits:
Object
  • Object
show all
Defined in:
lib/quarry_rb/data_set/example.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#exampleObject (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

#categoryObject



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_indexObject



23
24
25
# File 'lib/quarry_rb/data_set/example.rb', line 23

def category_index
  @example.get_category_index
end