Module: Vedeu::API::Helpers
Instance Method Summary collapse
-
#colour(values = {}) ⇒ Object
Define either or both foreground and background colours for an interface, line or a stream.
-
#style(values = [], &block) ⇒ Object
Define a style for an interface, line or a stream.
Instance Method Details
#colour(values = {}) ⇒ Object
Define either or both foreground and background colours for an interface, line or a stream.
25 26 27 28 29 30 |
# File 'lib/vedeu/api/helpers.rb', line 25 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
Define a style for an interface, line or a stream.
53 54 55 56 57 58 59 60 61 |
# File 'lib/vedeu/api/helpers.rb', line 53 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 |