Class: Swoop::Entity
- Inherits:
-
Object
- Object
- Swoop::Entity
- Defined in:
- lib/swoop/entity.rb
Instance Attribute Summary collapse
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #class? ⇒ Boolean
- #extension? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name, language, type) ⇒ Entity
constructor
A new instance of Entity.
- #objc? ⇒ Boolean
- #struct? ⇒ Boolean
- #swift? ⇒ Boolean
- #to_s ⇒ Object
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
#language ⇒ Object (readonly)
Returns the value of attribute language.
3 4 5 |
# File 'lib/swoop/entity.rb', line 3 def language @language end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/swoop/entity.rb', line 3 def name @name end |
#type ⇒ Object (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
19 20 21 |
# File 'lib/swoop/entity.rb', line 19 def class? type == "class" end |
#extension? ⇒ Boolean
27 28 29 |
# File 'lib/swoop/entity.rb', line 27 def extension? type == "extension" || type == "category" end |
#hash ⇒ Object
40 41 42 |
# File 'lib/swoop/entity.rb', line 40 def hash [name, language, type].hash end |
#objc? ⇒ Boolean
15 16 17 |
# File 'lib/swoop/entity.rb', line 15 def objc? language == "objc" end |
#struct? ⇒ Boolean
23 24 25 |
# File 'lib/swoop/entity.rb', line 23 def struct? type == "struct" end |
#swift? ⇒ Boolean
11 12 13 |
# File 'lib/swoop/entity.rb', line 11 def swift? language == "swift" end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/swoop/entity.rb', line 31 def to_s "#{language} - #{name} : #{type}" end |