Class: RideTheStreetcar::Apply

Inherits:
Object
  • Object
show all
Includes:
Streamlined::Renderable
Defined in:
lib/ride_the_streetcar/apply.rb

Instance Method Summary collapse

Constructor Details

#initialize(method_chain, *args) ⇒ Apply

Returns a new instance of Apply.



5
6
7
8
# File 'lib/ride_the_streetcar/apply.rb', line 5

def initialize(method_chain, *args)
  @method_chain = method_chain
  @args = args
end

Instance Method Details

#templateObject



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

def template
  attributes = { method: @method_chain }
  attributes[:args] = @args.to_json unless @args.empty?

  html -> { <<~HTML
    <sc-apply #{html_attributes attributes}></sc-apply>
  HTML
  }
end