Class: Botz::DefinitionFile

Inherits:
Object
  • Object
show all
Defined in:
lib/botz/definition_file.rb

Overview

botz interface binding

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#definitionObject (readonly)

Returns the value of attribute definition.



8
9
10
# File 'lib/botz/definition_file.rb', line 8

def definition
  @definition
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/botz/definition_file.rb', line 7

def path
  @path
end

Class Method Details

.open(filepath) ⇒ Object



11
12
13
14
15
# File 'lib/botz/definition_file.rb', line 11

def self.open(filepath)
  object = new(filepath)
  object.eval_definition
  object
end

Instance Method Details

#consoleObject



27
28
29
30
# File 'lib/botz/definition_file.rb', line 27

def console
  require 'pry'
  Pry.start(Botz::Console.new(self))
end

#eval_definitionObject

rubocop:disable Security/Eval



18
19
20
# File 'lib/botz/definition_file.rb', line 18

def eval_definition
  @definition = eval(File.open(path).read)
end

#shellObject

rubocop:enable Security/Eval



23
24
25
# File 'lib/botz/definition_file.rb', line 23

def shell
  @shell ||= Botz::Shell.new(self)
end