Module: Rib::Anchor

Extended by:
Plugin
Defined in:
lib/rib/more/anchor.rb

Defined Under Namespace

Modules: Imp

Instance Attribute Summary

Attributes included from Plugin

#disabled

Instance Method Summary collapse

Methods included from Plugin

const_missing, disable, disabled?, enable, enabled?, extended

Instance Method Details

#anchor?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/rib/more/anchor.rb', line 25

def anchor?
  !!config[:prompt_anchor]
end

#promptObject

————— Rib API —————



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rib/more/anchor.rb', line 10

def prompt
  return super if Rib::Anchor.disabled?
  return super unless anchor?

  level = "(#{Rib.shells.size - 1})"
  if Rib.const_defined?(:Color) &&
     kind_of?(Rib::Color)       &&
     Rib::Color.enabled?

    "#{format_color(eval_binding, prompt_anchor)}#{level}#{super}"
  else
    "#{prompt_anchor}#{level}#{super}"
  end
end