Module: Vedeu::DSL::Border::InstanceMethods

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

Overview

Provide additional behaviour as instance methods to the including class or module.

Instance Method Summary collapse

Instance Method Details

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

Specify the border of an interface or view with a simple DSL.

# As part of an interface:
Vedeu.interface :my_interface do
  border do
    # ... see {Vedeu::Borders::DSL}
  end
end

# As part of a view:
Vedeu.render do
  view :my_interface do
    border do
      # ... see {Vedeu::Borders::DSL}
    end
  end
end

Parameters:

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

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

  • block (Proc)

Returns:

Raises:

See Also:



41
42
43
44
45
46
47
48
# File 'lib/vedeu/dsl/border.rb', line 41

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

  model_name = name ? name : model.name

  Vedeu::Borders::Border.build(enabled: true,
                               name:    model_name, &block).store
end

#border!Vedeu::Borders::Border

Applies the default border to the interface or view.

# As part of an interface:
Vedeu.interface :my_interface do
  border!

  # ... some code
end

# As part of a view:
Vedeu.render do
  view :my_interface do
    border!

    # ... some code
  end
end


69
70
71
72
73
# File 'lib/vedeu/dsl/border.rb', line 69

def border!
  border do
    # adds default border
  end
end