Method: Vedeu::DSL::Elements#line

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

#line(value = '', opts = {}, &block) ⇒ void

TODO:

This documentation needs editing. (GL: 2015-12-17)

This method returns an undefined value.

Specify a single line in a view.

Vedeu.renders do
  view :my_interface do
    lines do
      line 'some text...'
      # ... some code

      line 'some more text...'
      # ... some code
    end
  end
end

Options Hash (opts):

  • ... (void)

Raises:

  • (Vedeu::Error::Fatal)

    When Vedeu does not understand that which the client application is attempting to achieve.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/vedeu/dsl/elements.rb', line 114

def line(value = '', opts = {}, &block)
  requires_model!

  attrs = build_attributes(value, opts, &block)

  l = if block_given?
        build_line(attrs, &block)

      else
        new_line(attrs)

      end

  if view_model?
    model.add(l)

  elsif line_model?
    model.add(l.value)

  else
    raise Vedeu::Error::Fatal,
          "Cannot add line to '#{model.class.name}' model."

  end
end