Module: Vedeu::API::Helpers

Included in:
Line, Stream
Defined in:
lib/vedeu/api/helpers.rb

Instance Method Summary collapse

Instance Method Details

#colour(values = {}) ⇒ Object



4
5
6
7
8
9
# File 'lib/vedeu/api/helpers.rb', line 4

def colour(values = {})
  fail InvalidArgument, '#colour expects a Hash containing :foreground,' \
                        ' :background or both.' unless values.is_a?(Hash)

  attributes[:colour] = values
end

#style(values = [], &block) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/vedeu/api/helpers.rb', line 11

def style(values = [], &block)
  if block_given?
    attributes[:streams] << API::Stream.build({ style: [values] }, &block)

  else
    [values].flatten.each { |value| attributes[:style] << value }

  end
end