Class: Cucumber::Messages::TableCell

Inherits:
Message
  • Object
show all
Defined in:
lib/cucumber/messages/table_cell.rb

Overview

Represents the TableCell message in Cucumber’s message protocol.

A cell in a ‘TableRow`

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

camelize, from_json, #to_h, #to_json

Constructor Details

#initialize(location: Location.new, value: '') ⇒ TableCell

Returns a new instance of TableCell.



23
24
25
26
27
28
29
30
# File 'lib/cucumber/messages/table_cell.rb', line 23

def initialize(
  location: Location.new,
  value: ''
)
  @location = location
  @value = value
  super()
end

Instance Attribute Details

#locationObject (readonly)

The location of the cell



16
17
18
# File 'lib/cucumber/messages/table_cell.rb', line 16

def location
  @location
end

#valueObject (readonly)

The value of the cell



21
22
23
# File 'lib/cucumber/messages/table_cell.rb', line 21

def value
  @value
end

Class Method Details

.from_h(hash) ⇒ Object

Returns a new TableCell from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.

Cucumber::Messages::TableCell.from_h(some_hash) # => #<Cucumber::Messages::TableCell:0x... ...>


39
40
41
42
43
44
45
46
# File 'lib/cucumber/messages/table_cell.rb', line 39

def self.from_h(hash)
  return nil if hash.nil?

  new(
    location: Location.from_h(hash[:location]),
    value: hash[:value]
  )
end