Class: RBS::Dynamic::Builder::Interface

Inherits:
Base
  • Object
show all
Defined in:
lib/rbs/dynamic/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Interface

Returns a new instance of Interface.



195
196
197
198
# File 'lib/rbs/dynamic/builder.rb', line 195

def initialize(name)
  super()
  @name = name
end

Instance Attribute Details

#methodsObject (readonly)

Returns the value of attribute methods.



193
194
195
# File 'lib/rbs/dynamic/builder.rb', line 193

def methods
  @methods
end

#nameObject (readonly)

Returns the value of attribute name.



192
193
194
# File 'lib/rbs/dynamic/builder.rb', line 192

def name
  @name
end

Instance Method Details

#buildObject



200
201
202
203
204
205
206
207
208
209
# File 'lib/rbs/dynamic/builder.rb', line 200

def build
  RBS::AST::Declarations::Interface.new(
    name: @name,
    type_params: [],
    members: build_members,
    annotations: [],
    location: nil,
    comment: nil
  )
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


211
212
213
214
# File 'lib/rbs/dynamic/builder.rb', line 211

def eql?(other)
  self.methods.map { |_, method| [method.name, method.kind, method.sigs] } ==
    other.methods.map { |_, method| [method.name, method.kind, method.sigs] }
end