Module: ShowCode

Defined in:
lib/show_code.rb,
lib/show_code/code.rb,
lib/show_code/version.rb,
lib/show_code/source_location.rb,
lib/show_code/syntax_exception.rb

Defined Under Namespace

Modules: SyntaxException Classes: Code, ModuleNotFound, SourceLocation, SourceLocationError

Constant Summary collapse

VERSION =
"0.1.7"

Class Method Summary collapse

Class Method Details

.open(obj) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/show_code.rb', line 15

def self.open(obj)
  sol  = SourceLocation.new obj
  file = sol.file

  %x[gedit #{file}]
  if $?.success?
    'File has opened via gedit!'
  else
    'Sorry, cannot open the file.'
  end
end

.parse(obj, opts = {}) ⇒ Object



8
9
10
11
12
13
# File 'lib/show_code.rb', line 8

def self.parse(obj, opts = {})
  sol  = SourceLocation.new obj
  code = Code.new sol
  puts code.highlighted opts
  sol.method
end