Sha256: 338ae1f16ea0d901571553d6ed073226fff84ee7458c83a28fd53667fc2af779

Contents?: true

Size: 554 Bytes

Versions: 4

Compression:

Stored size: 554 Bytes

Contents

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

        attributes[:colour] = values
      end

      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.1.15 lib/vedeu/api/helpers.rb
vedeu-0.1.14 lib/vedeu/api/helpers.rb
vedeu-0.1.13 lib/vedeu/api/helpers.rb
vedeu-0.1.12 lib/vedeu/api/helpers.rb