Class: Sevgi::Executor::Source

Inherits:
Data
  • Object
show all
Defined in:
lib/sevgi/executor/source.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string:, file: nil, line: nil) ⇒ Source

Returns a new instance of Source.



10
# File 'lib/sevgi/executor/source.rb', line 10

def initialize(string:, file: nil, line: nil) = super(string:, file: file || "sevgi", line: line || 1)

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



5
6
7
# File 'lib/sevgi/executor/source.rb', line 5

def file
  @file
end

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



5
6
7
# File 'lib/sevgi/executor/source.rb', line 5

def line
  @line
end

#stringObject (readonly)

Returns the value of attribute string

Returns:

  • (Object)

    the current value of string



5
6
7
# File 'lib/sevgi/executor/source.rb', line 5

def string
  @string
end

Class Method Details

.callObject



6
# File 'lib/sevgi/executor/source.rb', line 6

def self.call(...) = new(...)

.load(file) ⇒ Object



8
# File 'lib/sevgi/executor/source.rb', line 8

def self.load(file) = new(string: ::File.read(file), file: file, line: 1)

Instance Method Details

#keyObject



12
# File 'lib/sevgi/executor/source.rb', line 12

def key = file