Class: Ruby::Rego::AST::Import

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby/rego/ast/import.rb

Overview

Represents an import declaration.

Instance Attribute Summary collapse

Attributes inherited from Base

#location

Instance Method Summary collapse

Methods inherited from Base

#==, #accept, #deconstruct_keys, #eql?, format_value, #hash, #to_s

Constructor Details

#initialize(path:, alias_name: nil, location: nil) ⇒ Import

Returns a new instance of Import.

Parameters:

  • path (Array<String> | String)
  • alias_name (String, nil) (defaults to: nil)
  • location (Location, nil) (defaults to: nil)


13
14
15
16
17
# File 'lib/ruby/rego/ast/import.rb', line 13

def initialize(path:, alias_name: nil, location: nil)
  super(location: location)
  @path = path
  @alias = alias_name
end

Instance Attribute Details

#aliasString? (readonly)

Returns:

  • (String, nil)


23
24
25
# File 'lib/ruby/rego/ast/import.rb', line 23

def alias
  @alias
end

#pathArray<String> | String (readonly)

Returns:

  • (Array<String> | String)


20
21
22
# File 'lib/ruby/rego/ast/import.rb', line 20

def path
  @path
end

Instance Method Details

#alias_nameString?

Returns:

  • (String, nil)


26
27
28
# File 'lib/ruby/rego/ast/import.rb', line 26

def alias_name
  self.alias
end