Class: Rasti::App::Facade::InteractionSpecification

Inherits:
Object
  • Object
show all
Defined in:
lib/rasti/app/facade.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interaction, namespace) ⇒ InteractionSpecification

Returns a new instance of InteractionSpecification.



16
17
18
19
# File 'lib/rasti/app/facade.rb', line 16

def initialize(interaction, namespace)
  @interaction = interaction
  @namespace = namespace
end

Instance Attribute Details

#interactionObject (readonly)

Returns the value of attribute interaction.



14
15
16
# File 'lib/rasti/app/facade.rb', line 14

def interaction
  @interaction
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



14
15
16
# File 'lib/rasti/app/facade.rb', line 14

def namespace
  @namespace
end

Instance Method Details

#asynchronic?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/rasti/app/facade.rb', line 29

def asynchronic?
  interaction.asynchronic?
end

#form_attributesObject



37
38
39
# File 'lib/rasti/app/facade.rb', line 37

def form_attributes
  interaction.const_defined?(:Form) ? interaction.const_get(:Form).attributes : []
end

#nameObject



21
22
23
# File 'lib/rasti/app/facade.rb', line 21

def name
  permission.last_section.to_sym
end

#permissionObject



25
26
27
# File 'lib/rasti/app/facade.rb', line 25

def permission
  @permission ||= Permission.new interaction.name.sub("#{namespace.name}::", '').split('::').map { |s| Inflecto.underscore s }
end

#synchronic?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/rasti/app/facade.rb', line 33

def synchronic?
  !asynchronic?
end