Class: Swoop::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/swoop/entity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, language, type) ⇒ Entity

Returns a new instance of Entity.



5
6
7
8
9
# File 'lib/swoop/entity.rb', line 5

def initialize(name, language, type)
  @name = name
  @language = language
  @type = type
end

Instance Attribute Details

#languageObject (readonly)

Returns the value of attribute language.



3
4
5
# File 'lib/swoop/entity.rb', line 3

def language
  @language
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/swoop/entity.rb', line 3

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/swoop/entity.rb', line 3

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



35
36
37
# File 'lib/swoop/entity.rb', line 35

def ==(other)
  name == other.name && language == other.language && type == other.type
end

#class?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/swoop/entity.rb', line 19

def class?
  type == "class"
end

#extension?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/swoop/entity.rb', line 27

def extension?
  type == "extension" || type == "category"
end

#hashObject



40
41
42
# File 'lib/swoop/entity.rb', line 40

def hash
  [name, language, type].hash
end

#objc?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/swoop/entity.rb', line 15

def objc?
  language == "objc"
end

#struct?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/swoop/entity.rb', line 23

def struct?
  type == "struct"
end

#swift?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/swoop/entity.rb', line 11

def swift?
  language == "swift"
end

#to_sObject



31
32
33
# File 'lib/swoop/entity.rb', line 31

def to_s
  "#{language} - #{name} : #{type}"
end