Class: Pageflow::React::WidgetType

Inherits:
WidgetType show all
Defined in:
lib/pageflow/react/widget_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from WidgetType

#enabled_in_editor?, #enabled_in_preview?, #render_head_fragment, #translation_key

Constructor Details

#initialize(name, role) ⇒ WidgetType

Returns a new instance of WidgetType.



6
7
8
9
# File 'lib/pageflow/react/widget_type.rb', line 6

def initialize(name, role)
  @name = name
  @role = role
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/pageflow/react/widget_type.rb', line 4

def name
  @name
end

#roleObject (readonly)

Returns the value of attribute role.



4
5
6
# File 'lib/pageflow/react/widget_type.rb', line 4

def role
  @role
end

Instance Method Details

#render(template, _) ⇒ Object



15
16
17
# File 'lib/pageflow/react/widget_type.rb', line 15

def render(template, _)
  template.render(File.join('pageflow', 'react', 'widget'), name: name)
end

#rolesObject



11
12
13
# File 'lib/pageflow/react/widget_type.rb', line 11

def roles
  [role]
end