Class: Mortadella::Vertical

Inherits:
Object
  • Object
show all
Defined in:
lib/mortadella/vertical.rb

Overview

Makes it easy to build DRY horizontal Cucumber-compatible tables

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeVertical

Returns a new instance of Vertical.



9
10
11
# File 'lib/mortadella/vertical.rb', line 9

def initialize
  @table = []
end

Instance Attribute Details

#tableObject (readonly)

Returns the value of attribute table.



6
7
8
# File 'lib/mortadella/vertical.rb', line 6

def table
  @table
end

Instance Method Details

#[]=(header, row) ⇒ Object

Adds the given row to the table



15
16
17
# File 'lib/mortadella/vertical.rb', line 15

def []= header, row
  @table << [header, row]
end

#empty?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/mortadella/vertical.rb', line 20

def empty?
  @table.size == 1
end