Sha256: ea17cbc5bdbd9c73d990bf5cf2b26b60a1d937e6c18b441e85dab3ba126c9e72

Contents?: true

Size: 946 Bytes

Versions: 7

Compression:

Stored size: 946 Bytes

Contents

module RevealCK
  module Commands
    # This object represents controls the "User Interface" of the
    # serve command.
    class ServeUI
      PREFIXES = {
        default: '[ reveal-ck ]',
        problem: '[  problem  ]',
        rebuild: '[  rebuild  ]',
        reload:  '[   reload  ]'
      }.freeze

      def problem(general_problem, specific_error)
        blank :problem
        message general_problem, :problem
        blank :problem
        message specific_error, :problem
        blank :problem
      end

      def message(s, type = nil)
        prefix = prefix_for(type)
        puts "#{prefix} #{s}"
      end

      def prefix_for(type = nil)
        PREFIXES[type] || PREFIXES[:default]
      end

      def blank(type = nil)
        prefix = PREFIXES[type] || ''
        puts prefix.to_s
      end

      def separator
        puts '------------------------------------------------------------'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
reveal-ck-3.8.0 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-3.7.0 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-3.6.0 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-3.5.1 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-3.5.0 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-3.4.0 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-3.3.1 lib/reveal-ck/commands/serve_ui.rb