module Utter::Utils

Public Class Methods

included(klass) click to toggle source
# File lib/generators/utils/tips.rb, line 4
def self.included(klass)
  klass.extend self 
end

Public Instance Methods

method_missing(m, *args, &block) click to toggle source
# File lib/generators/utils/tips.rb, line 140
def method_missing(m, *args, &block)  
  case m

  when :utter_banner 
    extend Thor::Shell
    utter_title            = set_color(" Utter ", :red, :on_white, :bold)
    utter_version          = set_color(Utter::VERSION + " | ", :black, :on_white, :bold)
    #say(utter_title + utter_version )

    irc                      = set_color("", :green, :on_white, :bold)
    irc_url                = set_color("#utter @freenode.net" + " ", :green, :on_white, :bold)
    say(utter_title + utter_version + irc + irc_url)

    return # back to the calling routine

  when :about_utter
    #say("Utter is a Domain-specific Microservices Framework written in Ruby for building both regular and advanced Rule-based web APIs")

  when :ddd_quotes
    quote = @@ddd_quotes.sample

  when :design_qoutes
    quote = @@design_quotes.sample

  when :microservices_quotes 
    quote = @@microservices_quotes.sample

  else
    puts " Utter doesn't know #{m} -- please try again."  
  end

  def wrap(s, width=75)
    s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
  end

  say(wrap(quote))
end
wrap(s, width=75) click to toggle source
# File lib/generators/utils/tips.rb, line 171
def wrap(s, width=75)
  s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
end