Class: Botz::DefinitionFile

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

Overview

botz interface binding

Constant Summary collapse

CSV =
lambda do |result|
  ::CSV.generate do |csv|
    csv << result.definition.attributes_to_array
  end
end

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



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

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

Instance Method Details

#consoleObject



33
34
35
36
# File 'lib/botz/definition_file.rb', line 33

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

#eval_definitionObject

rubocop:disable Security/Eval



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

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

#shellObject

rubocop:enable Security/Eval



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

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