Class: Docbert::Converters::StepDefinitions::ParameterizedContent

Inherits:
Object
  • Object
show all
Defined in:
lib/docbert/converters/step_definitions/parameterized_content.rb

Instance Method Summary collapse

Constructor Details

#initialize(el, &block) ⇒ ParameterizedContent

Returns a new instance of ParameterizedContent.



5
6
7
8
# File 'lib/docbert/converters/step_definitions/parameterized_content.rb', line 5

def initialize(el, &block)
  self.el    = el
  self.block = block
end

Instance Method Details

#paramsObject



10
11
12
13
14
15
# File 'lib/docbert/converters/step_definitions/parameterized_content.rb', line 10

def params
  @params ||= el.
    children.
    select { |e| param?(e) }.
    map    { |e| param(e) }
end

#to_sObject



17
18
19
20
21
22
# File 'lib/docbert/converters/step_definitions/parameterized_content.rb', line 17

def to_s
  @s ||= el.
    children.
    map { |e| param?(e) ? block.(param(e)) : e.value }.
    join
end