Class: Opencdd::Cddal::AST::ImportDecl

Inherits:
Struct
  • Object
show all
Defined in:
lib/opencdd/cddal/ast.rb

Overview

CDDAL module import declaration. Three shapes, discriminated by kind:

:bare       — textual inclusion of every named declaration
            in the target. +specifier+ is the path/URL.
:qualified  — target's names are accessible as
            +<qualifier>.<name>+. +qualifier+ is the alias.
:selective  — only the names in +imported_names+ are pulled
            in, each subject to its optional rename.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#imported_namesObject

Returns the value of attribute imported_names

Returns:

  • (Object)

    the current value of imported_names



57
58
59
# File 'lib/opencdd/cddal/ast.rb', line 57

def imported_names
  @imported_names
end

#kindObject

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



57
58
59
# File 'lib/opencdd/cddal/ast.rb', line 57

def kind
  @kind
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



57
58
59
# File 'lib/opencdd/cddal/ast.rb', line 57

def line
  @line
end

#qualifierObject

Returns the value of attribute qualifier

Returns:

  • (Object)

    the current value of qualifier



57
58
59
# File 'lib/opencdd/cddal/ast.rb', line 57

def qualifier
  @qualifier
end

#specifierObject

Returns the value of attribute specifier

Returns:

  • (Object)

    the current value of specifier



57
58
59
# File 'lib/opencdd/cddal/ast.rb', line 57

def specifier
  @specifier
end

Class Method Details

.bare(specifier, line:) ⇒ Object



61
62
63
# File 'lib/opencdd/cddal/ast.rb', line 61

def self.bare(specifier, line:)
  new(specifier: specifier, kind: :bare, line: line)
end

.qualified(specifier, qualifier:, line:) ⇒ Object



65
66
67
# File 'lib/opencdd/cddal/ast.rb', line 65

def self.qualified(specifier, qualifier:, line:)
  new(specifier: specifier, kind: :qualified, qualifier: qualifier, line: line)
end

.selective(specifier, imported_names:, line:) ⇒ Object



69
70
71
# File 'lib/opencdd/cddal/ast.rb', line 69

def self.selective(specifier, imported_names:, line:)
  new(specifier: specifier, kind: :selective, imported_names: imported_names, line: line)
end

Instance Method Details

#urlObject

Backward-compat accessor for callers that expect url.



74
75
76
# File 'lib/opencdd/cddal/ast.rb', line 74

def url
  specifier
end