class Object

Object monkey patch for the mysh lineage method.

Monkey patches for mysh global entities.

Handlebar embedded ruby support.

Constants

MNV

Make the environment variable store accessible everywhere.

MYSH_LIB

The path to the gem lib folder.

Public Instance Methods

lineage() click to toggle source

Get the lineage of this object.

# File lib/mysh/expression/lineage.rb, line 7
def lineage
  klass = self.class
  to_s + " of " + klass.lineage
end

Private Instance Methods

cancel() click to toggle source

Unwrap one mysh layer.

# File lib/mysh/globalize.rb, line 18
def cancel
  raise MyshExit
end
eval_handlebar_file(name, evaluator) click to toggle source

Expand a file with embedded ruby handlebars. Note: The message receiver is the evaluation host for the handlebar code. Endemic Code Smells :reek:UtilityFunction

# File lib/mysh/handlebars.rb, line 19
def eval_handlebar_file(name, evaluator)
  IO.read(name).preprocess(evaluator)
end
latest_version_for(name, fetcher=nil) click to toggle source

Get the latest version for the named gem. Patched code.

# File lib/mysh/globalize.rb, line 23
def latest_version_for(name, fetcher=nil)
  dependency = Gem::Dependency.new(name)
  fetcher  ||= Gem::SpecFetcher.new

  if specs = fetcher.spec_for_dependency(dependency)[0][-1]
    specs[0].version
  else
    "<Not found in repository>"
  end
end
mysh(str) click to toggle source

The mysh equivalent of the system method. Endemic Code Smells :reek:UtilityFunction

# File lib/mysh/globalize.rb, line 13
def mysh(str)
  Mysh.try_execute_command(str)
end
show_handlebar_file(name, evaluator = $mysh_exec_binding) click to toggle source

Show a file with embedded ruby handlebars. Note: The message receiver is the evaluation host for the handlebar code.

# File lib/mysh/handlebars.rb, line 12
def show_handlebar_file(name, evaluator = $mysh_exec_binding)
  puts eval_handlebar_file(name, evaluator)
end