Class: ServerComponent::FetcherConfigurator

Inherits:
Object
  • Object
show all
Includes:
ServerComponentHelper
Defined in:
lib/server_component/component.rb

Instance Method Summary collapse

Methods included from ServerComponentHelper

#set_state

Constructor Details

#initialize(component_class, actions) ⇒ FetcherConfigurator

Returns a new instance of FetcherConfigurator.



7
8
9
10
# File 'lib/server_component/component.rb', line 7

def initialize(component_class, actions)
  @component_class = component_class
  @actions = actions
end

Instance Method Details

#accept_file!Object



20
21
22
# File 'lib/server_component/component.rb', line 20

def accept_file!
  set_value :upload, true
end

#beforeObject



12
13
14
15
16
17
18
# File 'lib/server_component/component.rb', line 12

def before
  jsrb = Jsrb::Base.new
  set_state(jsrb) do |s|
    yield(s, jsrb.expr.context.data)
  end
  set_value(:start_function, jsrb.generate_code)
end

#set_value(key, value) ⇒ Object



24
25
26
27
28
# File 'lib/server_component/component.rb', line 24

def set_value(key, value)
  @actions.each do |action|
    @component_class.action_descriptors[action][key] = value
  end
end