Sha256: 99a64ad4ce5fc2f9970037a7ada979b8decf9a3063a357415afa7d50b62367de

Contents?: true

Size: 939 Bytes

Versions: 10

Compression:

Stored size: 939 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  ]'
      }

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
reveal-ck-3.3.0 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-3.2.0 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-3.1.0 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-3.0.1 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-3.0.0 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-0.6.2 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-0.6.1 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-0.6.0 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-0.5.1 lib/reveal-ck/commands/serve_ui.rb
reveal-ck-0.5.0 lib/reveal-ck/commands/serve_ui.rb