Class: Reading::Row::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/reading/attribute/attribute.rb

Overview

A base class that contains behaviors common to ___Attribute classes.

Instance Method Summary collapse

Constructor Details

#initialize(item_head: nil, columns: nil, config:) ⇒ Attribute

Returns a new instance of Attribute.

Parameters:

  • item_head (String) (defaults to: nil)

    see Row#item_heads for a definition.

  • columns (Array<String>) (defaults to: nil)

    the CSV row split into columns.

  • config (Hash)


10
11
12
13
14
15
16
17
18
# File 'lib/reading/attribute/attribute.rb', line 10

def initialize(item_head: nil, columns: nil, config:)
  unless item_head || columns
    raise ArgumentError, "Either item_head or columns must be given to an Attribute."
  end

  @item_head = item_head
  @columns = columns
  @config = config
end

Instance Method Details

#parseObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/reading/attribute/attribute.rb', line 20

def parse
  raise NotImplementedError, "#{self.class} should have implemented #{__method__}"
end