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

disable, disabled?, enable, enabled?, extended

Instance Method Details

#bound_objectObject

override Underscore#bound_object



37
38
39
40
41
# File 'lib/rib/more/anchor.rb', line 37

def bound_object
  return super if Rib::Anchor.disabled?
  return super if eval_binding.kind_of?(Binding)
  eval_binding
end

#loop_eval(str) ⇒ Object

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



10
11
12
13
14
15
16
17
# File 'lib/rib/more/anchor.rb', line 10

def loop_eval str
  return super if Rib::Anchor.disabled?
  if eval_binding.kind_of?(Binding)
    super
  else
    eval_binding.instance_eval(str, "(#{name})", line)
  end
end

#promptObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rib/more/anchor.rb', line 19

def prompt
  return super if Rib::Anchor.disabled?
  return super unless config[:prompt_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