Method: Code.launch_dot_at_end

Defined in:
lib/xiki/code.rb

.launch_dot_at_end(line) ⇒ Object



800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
# File 'lib/xiki/code.rb', line 800

def self.launch_dot_at_end line
  prefix = Keys.prefix :clear=>1

  # If just Foo., show methods

  if line =~ /\A\w+\.\z/
    txt = Code.eval("#{line}meths")[0].map{|o| "- #{o}" }.join("\n")
    return Tree.<< txt, :no_slash=>1
  end

  if prefix == "open"   # If as+open, just navigate there
    return Search.open_file_and_method line.sub("./.", '.')
  end

  # It's foo./.bar/, so go to parent, collapse, and add this at end

  last = line.split('/').last
  Tree.to_parent
  CodeTree.kill_rest
  Line.sub! /\.$/, "#{last}"
  Move.to_end

  # If Foo. ... .bar, merge it back to parent (make Foo.bar), then launch

end