Module: Vedeu::DSL::Use

Included in:
Borders::DSL, Views, Geometries::DSL, Interfaces::DSL, Views::View::DSL
Defined in:
lib/vedeu/dsl/use.rb

Overview

Provides helper methods for building views.

Instance Method Summary collapse

Instance Method Details

#use(name) ⇒ void

Note:
  • Only models of the same repository can be used in this way.

  • If the stored model cannot be found, a ModelNotFound exception may be raised, or the request for an attribute may raise a NoMethodError exception.

This method returns an undefined value.

Use the attribute of stored model.

This DSL method provides access to a stored model by name. You can then request an attribute of that model for use within the current model. The models which current support this are Border, Geometry and Interface.

Examples:

# Here the character used for :my_border is used in
# :my_other_border.
Vedeu.border :my_other_border do
  top_right use(:my_border).top_right
end

Parameters:

  • name (String|Symbol)

    The name of the model with the value you wish to use.

Raises:

  • Vedeu::Error::ModelNotFound|Vedeu::Error::NoMethodError

    The model or attribute cannot be found.



38
39
40
# File 'lib/vedeu/dsl/use.rb', line 38

def use(name)
  model.repository.by_name(name)
end