Class: Interscript::Node::Item::Alias
- Inherits:
-
Interscript::Node::Item
- Object
- Interscript::Node
- Interscript::Node::Item
- Interscript::Node::Item::Alias
- Defined in:
- lib/interscript/node/item/alias.rb,
lib/interscript/visualize/nodes.rb
Instance Attribute Summary collapse
-
#map ⇒ Object
Returns the value of attribute map.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Interscript::Node::Item
Instance Method Summary collapse
- #==(other) ⇒ Object
- #boundary_like? ⇒ Boolean
-
#downcase ⇒ Object
Not implemented properly.
- #first_string ⇒ Object (also: #nth_string)
-
#initialize(name, map: nil) ⇒ Alias
constructor
A new instance of Alias.
- #inspect ⇒ Object
- #max_length ⇒ Object
- #stdlib? ⇒ Boolean
- #to_hash ⇒ Object
- #to_html(doc) ⇒ Object
- #upcase ⇒ Object
Methods inherited from Interscript::Node::Item
Constructor Details
#initialize(name, map: nil) ⇒ Alias
Returns a new instance of Alias.
4 5 6 7 |
# File 'lib/interscript/node/item/alias.rb', line 4 def initialize(name, map: nil) self.name = name self.map = map end |
Instance Attribute Details
#map ⇒ Object
Returns the value of attribute map.
3 4 5 |
# File 'lib/interscript/node/item/alias.rb', line 3 def map @map end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/interscript/node/item/alias.rb', line 2 def name @name end |
Instance Method Details
#==(other) ⇒ Object
43 44 45 |
# File 'lib/interscript/node/item/alias.rb', line 43 def ==(other) super && self.name == other.name && self.map == other.map end |
#boundary_like? ⇒ Boolean
13 14 15 |
# File 'lib/interscript/node/item/alias.rb', line 13 def boundary_like? Interscript::Stdlib.boundary_like_alias?(name) end |
#downcase ⇒ Object
Not implemented properly
27 |
# File 'lib/interscript/node/item/alias.rb', line 27 def downcase; self; end |
#first_string ⇒ Object Also known as: nth_string
30 31 32 |
# File 'lib/interscript/node/item/alias.rb', line 30 def first_string self end |
#inspect ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/interscript/node/item/alias.rb', line 47 def inspect if map "map.#{map}.#{name}" else "#{name}" end end |
#max_length ⇒ Object
17 18 19 20 21 22 23 24 |
# 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 |
#stdlib? ⇒ Boolean
9 10 11 |
# File 'lib/interscript/node/item/alias.rb', line 9 def stdlib? !map && Interscript::Stdlib::ALIASES.has_key?(name) end |
#to_hash ⇒ Object
36 37 38 39 40 41 |
# 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) ⇒ Object
3 4 5 6 7 8 9 10 |
# 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 ⇒ Object
28 |
# File 'lib/interscript/node/item/alias.rb', line 28 def upcase; self; end |