module Rib::Anchor::Imp
Public Instance Methods
anchor(obj_or_binding, opts={})
click to toggle source
Enter an interactive Rib
shell based on a particular context.
@api public @param obj_or_binding [Object, Binding] The context of the shell. @param opts [Hash] The config hash passed to the newly created shell.
See {Rib::Shell#initialize} for all possible options.
@return [Rib::Skip] This is the mark telling Rib
do not print anything.
It's only used internally in Rib.
@see Rib::Shell#initialize @example
Rib.anchor binding Rib.anchor 123
# File lib/rib/more/anchor.rb, line 54 def anchor obj_or_binding, opts={} return if Rib::Anchor.disabled? if Rib.shell.running? Rib.shells << Rib::Shell.new( Rib.shell.config.merge( :binding => obj_or_binding, :prompt_anchor => true ). merge(opts)) else Rib.shell.config.merge!(:binding => obj_or_binding, :prompt_anchor => true ). merge!(opts) end Rib.shell.loop Rib::Skip ensure Rib.shells.pop end
stop_anchors()
click to toggle source
# File lib/rib/more/anchor.rb, line 75 def stop_anchors Rib.shells.select(&:anchor?).each(&:stop) Rib::Skip end