Sha256: 6955ec8201200e20897fe570b53e36af700721ecc68809eb2a8c32c9fd387a49

Contents?: true

Size: 755 Bytes

Versions: 2

Compression:

Stored size: 755 Bytes

Contents

module Quarry
  module DataSet
    class Example
      attr_reader :example
      
      def initialize(example, data_set)
        @data_set = data_set
        @example  = example
      end
      
      def [](index)
        @example.get_value(index)
      end
      
      def []=(index, value)
        @example.set_value(index, value)
      end
      
      def category
        @data_set.categories[@example.get_category_index]
      end
      
      def category_index
        @example.get_category_index
      end
      
      def category=(new_category)
        raise "new_category must be an instance of Quarry::DataSet::Category" unless new_category.is_a?(Category)
        @example.set_category(new_category.category)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thera-0.0.2 lib/quarry_rb/data_set/example.rb
thera-0.0.1 lib/quarry_rb/data_set/example.rb