class Interscript::Node::Item::Alias

Attributes

map[RW]
name[RW]

Public Class Methods

new(name, map: nil) click to toggle source
# File lib/interscript/node/item/alias.rb, line 4
def initialize(name, map: nil)
  self.name = name
  self.map = map
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method Interscript::Node::Item#==
# File lib/interscript/node/item/alias.rb, line 43
def ==(other)
  super && self.name == other.name && self.map == other.map
end
boundary_like?() click to toggle source
# File lib/interscript/node/item/alias.rb, line 13
def boundary_like?
  Interscript::Stdlib.boundary_like_alias?(name)
end
downcase() click to toggle source

Not implemented properly

# File lib/interscript/node/item/alias.rb, line 27
def downcase; self; end
first_string() click to toggle source
# File lib/interscript/node/item/alias.rb, line 30
def first_string
  self
end
Also aliased as: nth_string
inspect() click to toggle source
# File lib/interscript/node/item/alias.rb, line 47
def inspect
  if map
    "map.#{map}.#{name}"
  else
    "#{name}"
  end
end
max_length() click to toggle source
# File lib/interscript/node/item/alias.rb, line 17
def max_length
  if stdlib?
    ([:none].include? name) ? 0 : 1
  else
    return 1 if name == :unicode_hangul
    raise NotImplementedError, "can't get a max length of this alias"
  end
end
nth_string()
Alias for: first_string
stdlib?() click to toggle source
# File lib/interscript/node/item/alias.rb, line 9
def stdlib?
  !map && Interscript::Stdlib::ALIASES.has_key?(name)
end
to_hash() click to toggle source
# File lib/interscript/node/item/alias.rb, line 36
def to_hash
  { :class => self.class.to_s,
    :name => name,
    :map => map,
  }
end
to_html(doc) click to toggle source
# File lib/interscript/visualize/nodes.rb, line 3
def to_html(doc)
  if map
    n = doc.dep_aliases[map].full_name
    "#{name.to_s.gsub("_", " ")} from map #{n}"
  else
    "#{name.to_s.gsub("_", " ")}"
  end
end
upcase() click to toggle source
# File lib/interscript/node/item/alias.rb, line 28
def upcase; self; end