Class: Riddl::Wrapper::Declaration::Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/riddl/wrapper/declaration/interface.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, top, base, sub, des) ⇒ Interface

Returns a new instance of Interface.



6
7
8
9
10
11
12
# File 'lib/ruby/riddl/wrapper/declaration/interface.rb', line 6

def initialize(name,top,base,sub,des)
  @name = name
  @top  = top
  @base = base
  @sub  = sub
  @des  = des
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



29
30
31
# File 'lib/ruby/riddl/wrapper/declaration/interface.rb', line 29

def base
  @base
end

#desObject (readonly)

Returns the value of attribute des.



29
30
31
# File 'lib/ruby/riddl/wrapper/declaration/interface.rb', line 29

def des
  @des
end

#nameObject (readonly)

Returns the value of attribute name.



29
30
31
# File 'lib/ruby/riddl/wrapper/declaration/interface.rb', line 29

def name
  @name
end

#subObject (readonly)

Returns the value of attribute sub.



29
30
31
# File 'lib/ruby/riddl/wrapper/declaration/interface.rb', line 29

def sub
  @sub
end

#topObject (readonly)

Returns the value of attribute top.



29
30
31
# File 'lib/ruby/riddl/wrapper/declaration/interface.rb', line 29

def top
  @top
end

Class Method Details

.new_from_interface(interface, sub) ⇒ Object



14
15
16
# File 'lib/ruby/riddl/wrapper/declaration/interface.rb', line 14

def self.new_from_interface(interface,sub)
  Interface.new(interface.name,interface.top,interface.base,sub,interface.des)
end

Instance Method Details

#real_path(real) ⇒ Object



18
19
20
21
22
23
# File 'lib/ruby/riddl/wrapper/declaration/interface.rb', line 18

def real_path(real)
  t = @top.split('/')
  real = real.split('/')
  real = real[t.length..-1]
  real.join('/')
end

#real_url(real, base) ⇒ Object



25
26
27
# File 'lib/ruby/riddl/wrapper/declaration/interface.rb', line 25

def real_url(real,base)
  (@base == '' ? base : @base) + real_path(real)
end