Class: Hairballs::Prompt
- Inherits:
-
Object
- Object
- Hairballs::Prompt
- Defined in:
- lib/hairballs/prompt.rb
Overview
Hairballs representation of IRB.conf. Method names here make prompt types clearer.
TODO: Make it nicer to define Pry prompts.
Instance Attribute Summary collapse
- #auto_indent ⇒ Object
-
#continued_statement ⇒ Object
(also: #c)
The prompt for when statements wrap multiple lines.
-
#continued_string ⇒ Object
(also: #s)
The prompt for when strings wrap multiple lines.
-
#indented_code ⇒ Object
(also: #n)
The prompt for when statements include indentation.
-
#normal ⇒ Object
(also: #i)
The normal prompt string.
-
#return_format ⇒ Object
The prompt for return values.
Instance Method Summary collapse
-
#irb_configuration ⇒ Hash
A set of key/value pairs that can be used to pass to a IRB.conf[ prompt name ].
Instance Attribute Details
#auto_indent ⇒ Object
8 9 10 |
# File 'lib/hairballs/prompt.rb', line 8 def auto_indent @auto_indent end |
#continued_statement ⇒ Object Also known as: c
The prompt for when statements wrap multiple lines. Same as IRB.conf[ prompt name ][:PROMPT_C]
30 31 32 |
# File 'lib/hairballs/prompt.rb', line 30 def continued_statement @continued_statement end |
#continued_string ⇒ Object Also known as: s
The prompt for when strings wrap multiple lines. Same as IRB.conf[ prompt name ][:PROMPT_S]
22 23 24 |
# File 'lib/hairballs/prompt.rb', line 22 def continued_string @continued_string end |
#indented_code ⇒ Object Also known as: n
The prompt for when statements include indentation. Same as IRB.conf[ prompt name ][:PROMPT_N]
38 39 40 |
# File 'lib/hairballs/prompt.rb', line 38 def indented_code @indented_code end |
#normal ⇒ Object Also known as: i
The normal prompt string. Same as IRB.conf[ prompt name ][:PROMPT_I]
14 15 16 |
# File 'lib/hairballs/prompt.rb', line 14 def normal @normal end |
#return_format ⇒ Object
The prompt for return values. Same as IRB.conf[ prompt name ][:RETURN]
46 47 48 |
# File 'lib/hairballs/prompt.rb', line 46 def return_format @return_format end |
Instance Method Details
#irb_configuration ⇒ Hash
Returns A set of key/value pairs that can be used to pass to a IRB.conf[ prompt name ].
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/hairballs/prompt.rb', line 50 def irb_configuration vputs 'Setting up prompt...' prompt_values = {} prompt_values[:AUTO_INDENT] = @auto_indent if @auto_indent prompt_values[:PROMPT_C] = continued_statement unless continued_statement.empty? prompt_values[:PROMPT_I] = normal unless normal.empty? prompt_values[:PROMPT_N] = indented_code unless indented_code.empty? prompt_values[:PROMPT_S] = continued_string unless continued_string.empty? prompt_values[:RETURN] = @return_format if @return_format prompt_values end |