Module: Vedeu::DSL::Shared

Included in:
View, Interfaces::DSL
Defined in:
lib/vedeu/dsl/shared.rb

Overview

Provides behaviour to be shared between both Interfaces::DSL and View objects.

Instance Method Summary collapse

Instance Method Details

#border(name = nil, &block) ⇒ Vedeu::Borders::Border

Allows the setting of a border for the interface.

Examples:

Vedeu.interface :my_interface do
  border do
    # ... see Vedeu::Borders::DSL for DSL methods for
    #     borders.
  end
end

Parameters:

  • name (String|Symbol) (defaults to: nil)

    The name of the interface; this is already provided when we define the interface or view, setting it here is just mirroring functionality of Borders::DSL.border.

  • block (Proc)

Returns:

Raises:

See Also:



28
29
30
31
32
33
34
35
36
37
# File 'lib/vedeu/dsl/shared.rb', line 28

def border(name = nil, &block)
  fail Vedeu::Error::RequiresBlock unless block_given?

  model_name = name ? name : model.name

  border_attrs = attributes.merge!(enabled: true,
                                   name:    model_name)

  Vedeu::Borders::Border.build(border_attrs, &block).store
end

#border!Vedeu::Borders::Border

Applies the default border to the interface.

Examples:

Vedeu.interface :my_interface do
  border!

  # ... some code
end

Returns:



49
50
51
52
53
# File 'lib/vedeu/dsl/shared.rb', line 49

def border!
  border do
    # adds default border
  end
end

#geometry(name = nil, &block) ⇒ Vedeu::Geometry::Geometry

Define the geometry for an interface.

Examples:

Vedeu.interface :my_interface do
  geometry do
    # ... see Vedeu::Geometry::DSL for DSL methods for
    #     geometries.
  end
end

Parameters:

  • name (String|Symbol) (defaults to: nil)

    The name of the interface; this is already provided when we define the interface or view, setting it here is just mirroring functionality of Geometry::DSL.geometry.

  • block (Proc)

Returns:

Raises:

See Also:



73
74
75
76
77
78
79
# File 'lib/vedeu/dsl/shared.rb', line 73

def geometry(name = nil, &block)
  fail Vedeu::Error::RequiresBlock unless block_given?

  model_name = name ? name : model.name

  Vedeu::Geometry::Geometry.build(name: model_name, &block).store
end