Class: Emfrp::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/emfrp/syntax.rb

Instance Method Summary collapse

Constructor Details

#initialize(syntax, name = nil) ⇒ Link

Returns a new instance of Link.



42
43
44
45
# File 'lib/emfrp/syntax.rb', line 42

def initialize(syntax, name=nil)
  @link = syntax
  @name = name
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/emfrp/syntax.rb', line 55

def eql?(other)
  self.hash == other.hash
end

#getObject



47
48
49
# File 'lib/emfrp/syntax.rb', line 47

def get
  @link
end

#hashObject



51
52
53
# File 'lib/emfrp/syntax.rb', line 51

def hash
  @link.object_id
end

#inspectObject



59
60
61
62
63
64
65
# File 'lib/emfrp/syntax.rb', line 59

def inspect
  if @name || @link.has_key?(:name)
    "Link(#{@name || @link[:name][:desc]} : #{@link.class})"
  else
    "Link(#{@link.class})"
  end
end

#to_sObject



67
68
69
# File 'lib/emfrp/syntax.rb', line 67

def to_s
  inspect
end