Class: Swoop::FileInfo

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath, language, line_count, classes, structs, extensions) ⇒ FileInfo

Returns a new instance of FileInfo.



13
14
15
16
17
18
19
20
# File 'lib/swoop/file_info.rb', line 13

def initialize(filepath, language, line_count, classes, structs, extensions)
  @filepath = filepath
  @language = language
  @line_count = line_count
  @classes = classes
  @structs = structs
  @extensions = extensions
end

Instance Attribute Details

#classesObject (readonly)

Returns the value of attribute classes.



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

def classes
  @classes
end

#extensionsObject (readonly)

Returns the value of attribute extensions.



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

def extensions
  @extensions
end

#filepathObject (readonly)

Returns the value of attribute filepath.



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

def filepath
  @filepath
end

#languageObject (readonly)

Returns the value of attribute language.



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

def language
  @language
end

#line_countObject (readonly)

Returns the value of attribute line_count.



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

def line_count
  @line_count
end

#structsObject (readonly)

Returns the value of attribute structs.



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

def structs
  @structs
end

Instance Method Details

#==(comparee) ⇒ Object



44
45
46
# File 'lib/swoop/file_info.rb', line 44

def ==(comparee)
  self.filepath == comparee.filepath
end

#entitiesObject



30
31
32
33
34
# File 'lib/swoop/file_info.rb', line 30

def entities
  @entities ||= begin
    [ *classes, *structs, *extensions ]
  end
end

#eql?(comparee) ⇒ Boolean

Returns:

  • (Boolean)


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

def eql?(comparee)
  self == comparee
end

#hashObject



36
37
38
# File 'lib/swoop/file_info.rb', line 36

def hash
  filepath.hash
end

#objc?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/swoop/file_info.rb', line 26

def objc?
  language == Lang::OBJC
end

#swift?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/swoop/file_info.rb', line 22

def swift?
  language == Lang::SWIFT
end