Module: JazzHands
- Extended by:
- JazzHands
- Included in:
- JazzHands
- Defined in:
- lib/jazz_hands.rb,
lib/jazz_hands/railtie.rb,
lib/jazz_hands/version.rb
Defined Under Namespace
Classes: Railtie
Constant Summary collapse
- VERSION =
'0.3.1'
Instance Attribute Summary collapse
-
#hirb_output ⇒ Object
Internal methods ###.
Instance Method Summary collapse
-
#enable_syntax_highlighting_as_you_type ⇒ Object
Enable syntax highlighting as you type in the Rails console via coolline and coderay (MRI 1.9.3+ only).
Instance Attribute Details
#hirb_output ⇒ Object
Internal methods ###
38 39 40 |
# File 'lib/jazz_hands.rb', line 38 def hirb_output @hirb_output end |
Instance Method Details
#enable_syntax_highlighting_as_you_type ⇒ Object
Enable syntax highlighting as you type in the Rails console via coolline and coderay (MRI 1.9.3+ only). Disabled by default as it’s a bit buggy.
Call from a Rails initializer:
JazzHands.enable_syntax_highlighting_as_you_type
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jazz_hands.rb', line 14 def enable_syntax_highlighting_as_you_type raise 'Syntax highlighting only supported on 1.9.3+' unless RUBY_VERSION >= '1.9.3' # Use coolline with CodeRay for syntax highlighting as you type. # Only works on >= 1.9.3 because coolline depends on io/console. require 'coolline' require 'coderay' Pry.config.input = Coolline.new do |c| c.transform_proc = proc do CodeRay.scan(c.line, :ruby).term end c.completion_proc = proc do word = c.completed_word Object.constants.map(&:to_s).select { |w| w.start_with? word } end end end |