Class: Source

Inherits:
Object
  • Object
show all
Defined in:
lib/oso/polar/polar.rb

Overview

Polar source string with optional filename.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(src, filename: nil) ⇒ Source

Returns a new instance of Source.

Parameters:

  • src (String)
  • filename (String) (defaults to: nil)


37
38
39
40
# File 'lib/oso/polar/polar.rb', line 37

def initialize(src, filename: nil)
  @src = src
  @filename = filename
end

Instance Attribute Details

#filenameString (readonly)

Returns:

  • (String)


33
34
35
# File 'lib/oso/polar/polar.rb', line 33

def filename
  @filename
end

#srcString (readonly)

Returns:

  • (String)


33
34
35
# File 'lib/oso/polar/polar.rb', line 33

def src
  @src
end

Instance Method Details

#to_json(*_args) ⇒ Object



42
43
44
# File 'lib/oso/polar/polar.rb', line 42

def to_json(*_args)
  { src: src, filename: filename }.to_json
end