Class: IRB::Kit::Prompter
- Inherits:
-
Object
- Object
- IRB::Kit::Prompter
- Defined in:
- lib/irb/kit/prompter.rb
Overview
Dynamically computes prompt based environment.
Constant Summary collapse
- COLORS =
{green: 32, red: 31}.freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(version = RUBY_VERSION, delimiter: "|", colors: COLORS) ⇒ Prompter
constructor
A new instance of Prompter.
Constructor Details
#initialize(version = RUBY_VERSION, delimiter: "|", colors: COLORS) ⇒ Prompter
Returns a new instance of Prompter.
9 10 11 12 13 14 |
# File 'lib/irb/kit/prompter.rb', line 9 def initialize version = RUBY_VERSION, delimiter: "|", colors: COLORS super() @version = version @delimiter = delimiter @colors = colors end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/irb/kit/prompter.rb', line 16 def call if defined? Hanami::VERSION details Hanami::VERSION, Hanami.app.name.delete_suffix("::App"), Hanami.env elsif defined? Rails details Rails.version, Rails.application.class.module_parent_name, Rails.env else version_with_optional_project end end |