Module: MiniKraken::Core::Entry

Included in:
LogVar, Rela::DefRelation
Defined in:
lib/mini_kraken/core/entry.rb

Overview

Mix-in module that implements the expected common behaviour of entries placed in the symbol table.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameString (readonly) Also known as: label

Returns User-defined name of the entry.

Returns:

  • (String)

    User-defined name of the entry.



9
10
11
# File 'lib/mini_kraken/core/entry.rb', line 9

def name
  @name
end

#suffixString

Returns Suffix for building the internal name of the entry.

Returns:

  • (String)

    Suffix for building the internal name of the entry.



12
13
14
# File 'lib/mini_kraken/core/entry.rb', line 12

def suffix
  @suffix
end

Instance Method Details

#i_nameString

Return the internal name of the entry Internal names used to disambiguate entry names. There might be homonyns between variable because:

- A child Scope may have a entry with same name as one of its
  ancestor(s).
- Multiple calls to same defrel or procedure may imply multiple creation
  of a entry given name...

Returns:

  • (String)

    internal name



31
32
33
34
35
36
37
# File 'lib/mini_kraken/core/entry.rb', line 31

def i_name
  if suffix =~ /^_/
    label + suffix
  else
    (suffix.nil? || suffix.empty?) ? label : suffix
  end
end

#init_name(aName) ⇒ Object

Initialize the entry with given name

Parameters:

  • aName (String)

    The name of the entry



18
19
20
21
# File 'lib/mini_kraken/core/entry.rb', line 18

def init_name(aName)
  @name = aName.dup
  @name.freeze
end