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
-
#irb_prompt_options ⇒ Object
readonly
Returns the value of attribute irb_prompt_options.
Instance Method Summary collapse
- #continued_statement ⇒ String
-
#continued_statement=(new_continued_statement) ⇒ Object
Wrapper for setting IRB.conf[:MY_PROMPT].
- #continued_string ⇒ String
-
#continued_string=(new_continued_string) ⇒ Object
Wrapper for setting IRB.conf[:MY_PROMPT].
- #indented_code ⇒ String
-
#indented_code=(new_indented_code) ⇒ Object
Wrapper for setting IRB.conf[:MY_PROMPT].
-
#initialize ⇒ Prompt
constructor
A new instance of Prompt.
- #normal ⇒ String
-
#normal=(new_normal) ⇒ Object
Wrapper for setting IRB.conf[:MY_PROMPT].
- #return_format ⇒ String
-
#return_format=(new_return_format) ⇒ Object
Wrapper for setting IRB.conf[:MY_PROMPT].
Constructor Details
#initialize ⇒ Prompt
Returns a new instance of Prompt.
15 16 17 18 |
# File 'lib/hairballs/prompt.rb', line 15 def initialize vputs 'Setting up prompt...' @irb_prompt_options = IRB.conf[:PROMPT][:NULL].dup end |
Instance Attribute Details
#irb_prompt_options ⇒ Object (readonly)
Returns the value of attribute irb_prompt_options.
13 14 15 |
# File 'lib/hairballs/prompt.rb', line 13 def @irb_prompt_options end |
Instance Method Details
#continued_statement ⇒ String
29 30 31 |
# File 'lib/hairballs/prompt.rb', line 29 def continued_statement @irb_prompt_options[:PROMPT_C] end |
#continued_statement=(new_continued_statement) ⇒ Object
Wrapper for setting IRB.conf[:MY_PROMPT]. The prompt for when statements wrap multiple lines.
24 25 26 |
# File 'lib/hairballs/prompt.rb', line 24 def continued_statement=(new_continued_statement) @irb_prompt_options[:PROMPT_C] = new_continued_statement end |
#continued_string ⇒ String
42 43 44 |
# File 'lib/hairballs/prompt.rb', line 42 def continued_string @irb_prompt_options[:PROMPT_S] end |
#continued_string=(new_continued_string) ⇒ Object
Wrapper for setting IRB.conf[:MY_PROMPT]. The prompt for when strings wrap multiple lines.
37 38 39 |
# File 'lib/hairballs/prompt.rb', line 37 def continued_string=(new_continued_string) @irb_prompt_options[:PROMPT_S] = new_continued_string end |
#indented_code ⇒ String
55 56 57 |
# File 'lib/hairballs/prompt.rb', line 55 def indented_code @irb_prompt_options[:PROMPT_N] end |
#indented_code=(new_indented_code) ⇒ Object
Wrapper for setting IRB.conf[:MY_PROMPT]. The prompt for when statements include indentation.
50 51 52 |
# File 'lib/hairballs/prompt.rb', line 50 def indented_code=(new_indented_code) @irb_prompt_options[:PROMPT_N] = new_indented_code end |
#normal ⇒ String
67 68 69 |
# File 'lib/hairballs/prompt.rb', line 67 def normal @irb_prompt_options[:PROMPT_I] end |
#normal=(new_normal) ⇒ Object
Wrapper for setting IRB.conf[:MY_PROMPT].
62 63 64 |
# File 'lib/hairballs/prompt.rb', line 62 def normal=(new_normal) @irb_prompt_options[:PROMPT_I] = new_normal end |
#return_format ⇒ String
80 81 82 |
# File 'lib/hairballs/prompt.rb', line 80 def return_format @irb_prompt_options[:RETURN] end |
#return_format=(new_return_format) ⇒ Object
Wrapper for setting IRB.conf[:MY_PROMPT]. The prompt for how to display return values.
75 76 77 |
# File 'lib/hairballs/prompt.rb', line 75 def return_format=(new_return_format) @irb_prompt_options[:RETURN] = new_return_format end |