Class: Cucumber::Messages::Rule
- Defined in:
- lib/cucumber/messages/rule.rb
Overview
Represents the Rule message in Cucumber’s message protocol.
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
-
#location ⇒ Object
readonly
The location of the ‘Rule` keyword.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tags ⇒ Object
readonly
All the tags placed above the ‘Rule` keyword.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new Rule from the given hash.
Instance Method Summary collapse
-
#initialize(location: Location.new, tags: [], keyword: '', name: '', description: '', children: [], id: '') ⇒ Rule
constructor
A new instance of Rule.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(location: Location.new, tags: [], keyword: '', name: '', description: '', children: [], id: '') ⇒ Rule
Returns a new instance of Rule.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cucumber/messages/rule.rb', line 31 def initialize( location: Location.new, tags: [], keyword: '', name: '', description: '', children: [], id: '' ) @location = location @tags = @keyword = keyword @name = name @description = description @children = children @id = id super() end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
27 28 29 |
# File 'lib/cucumber/messages/rule.rb', line 27 def children @children end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
25 26 27 |
# File 'lib/cucumber/messages/rule.rb', line 25 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
29 30 31 |
# File 'lib/cucumber/messages/rule.rb', line 29 def id @id end |
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
21 22 23 |
# File 'lib/cucumber/messages/rule.rb', line 21 def keyword @keyword end |
#location ⇒ Object (readonly)
The location of the ‘Rule` keyword
14 15 16 |
# File 'lib/cucumber/messages/rule.rb', line 14 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
23 24 25 |
# File 'lib/cucumber/messages/rule.rb', line 23 def name @name end |
#tags ⇒ Object (readonly)
All the tags placed above the ‘Rule` keyword
19 20 21 |
# File 'lib/cucumber/messages/rule.rb', line 19 def @tags end |
Class Method Details
.from_h(hash) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/cucumber/messages/rule.rb', line 57 def self.from_h(hash) return nil if hash.nil? new( location: Location.from_h(hash[:location]), tags: hash[:tags]&.map { |item| Tag.from_h(item) }, keyword: hash[:keyword], name: hash[:name], description: hash[:description], children: hash[:children]&.map { |item| RuleChild.from_h(item) }, id: hash[:id] ) end |