Class: Object

Inherits:
BasicObject
Defined in:
lib/mysh/globalize.rb,
lib/mysh/handlebars.rb,
lib/mysh/expression/lineage.rb,
lib/mysh/internal/format/object.rb

Overview

  • internal/format/object.rb - Support for displaying data formatted neatly.

Constant Summary collapse

MNV =

Make the environment variable store accessible everywhere.

Mysh::MNV

Instance Method Summary collapse

Instance Method Details

#eval_handlebar_file(name, evaluator) ⇒ Object

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

  • :reek:UtilityFunction



20
21
22
# File 'lib/mysh/handlebars.rb', line 20

def eval_handlebar_file(name, evaluator)
  IO.read(name).preprocess(evaluator)
end

#format_description(max_width) ⇒ Object

Create a bullet point description from this object.



7
8
9
# File 'lib/mysh/internal/format/object.rb', line 7

def format_description(max_width)
  self.to_s.format_description(max_width)
end

#lineageObject

Get the lineage of this object.



7
8
9
10
# File 'lib/mysh/expression/lineage.rb', line 7

def lineage
  klass = self.class
  to_s + " of " + klass.lineage
end

#prepare_bullet_dataObject

Get data ready for being in a bullet point.



12
13
14
# File 'lib/mysh/internal/format/object.rb', line 12

def prepare_bullet_data
  ["*", self]
end

#show_handlebar_file(name, evaluator = $mysh_exec_host) ⇒ Object

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



11
12
13
# File 'lib/mysh/handlebars.rb', line 11

def show_handlebar_file(name, evaluator = $mysh_exec_host)
  puts eval_handlebar_file(name, evaluator)
end