Sha256: 105c8cc1be7ab0eac6869ba5c6bf47242e3cc073e3bb45e6641bc15cb0d270c1
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
module JazzFingers class Configuration attr_writer :colored_prompt, :prompt_separator, :coolline, :awesome_print, :application_name # Color the prompt? # # A different setting than Pry.color since some may like colored output, but a # plain prompt. # # Default: 'true' for GNU readline or rb-readline which correctly count line # widths with color codes when using \001 and \002 hints. 'false' for # libedit-based wrapper (standard on OS X unless ruby is explicitly compiled # otherwise). def colored_prompt return (Readline::VERSION !~ /EditLine/) && Pry.color if @colored_prompt.nil? @colored_prompt end # Separator between application name and input in the prompt. # # Default: right angle quote, or '>' when using rb-readline which doesn't # handle mixed encodings well. def prompt_separator @prompt_separator ||= defined?(RbReadline) ? '>' : "\u00BB" end def coolline? return false if @coolline.nil? @coolline end def awesome_print? return true if @awesome_print.nil? @awesome_print end def application_name return "(#{underscore(@application_name)})" unless @application_name.nil? return "(#{Rails.application.class.parent_name.underscore})" if defined?(Rails) '(jazz_fingers)' end private def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr('-', '_') .downcase end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jazz_fingers-5.0.1 | lib/jazz_fingers/configuration.rb |
jazz_fingers-5.0.0 | lib/jazz_fingers/configuration.rb |