Method: Vedeu::Interfaces::DSL.interface

Defined in:
lib/vedeu/interfaces/dsl.rb

.interface(name, &block) ⇒ Vedeu::Interfaces::Interface

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

TODO:

More documentation required.

Register an interface by name which will display output from an event or a command. This provides the means for you to define your the views of your application without their content.

Vedeu.interface :my_interface do
  # ... some code
end

Parameters:

  • name (NilClass|Symbol|String)

    The name of the model or target model to act upon. May default to Vedeu.focus.

  • block (Proc)

Returns:

Raises:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/vedeu/interfaces/dsl.rb', line 40

def interface(name, &block)
  raise Vedeu::Error::MissingRequired unless name
  raise Vedeu::Error::RequiresBlock unless block_given?

  attributes = { client: client(&block), name: name }

  interface = Vedeu::Interfaces::Interface
              .build(attributes, &block)
              .store

  add_buffers!(name)
  add_cursor!(name)
  add_editor!(name) if interface.editable?
  add_focusable!(name)
  add_keymap!(name)

  interface
end