Class: Mini::Guard::XFile

Inherits:
Object
  • Object
show all
Defined in:
lib/mini/guard.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, code:, specs:, views:, factories:) ⇒ XFile

Returns a new instance of XFile.



55
56
57
58
59
60
61
# File 'lib/mini/guard.rb', line 55

def initialize(path, code:, specs:, views:, factories:)
  @path          = path
  stat           = File.stat(path)
  @size          = stat.size
  @last_modified = stat.ctime
  @associations  = find_associations(code: code, specs: specs, views: views, factories: factories)
end

Instance Attribute Details

#associationsObject (readonly)

Returns the value of attribute associations.



53
54
55
# File 'lib/mini/guard.rb', line 53

def associations
  @associations
end

#last_modifiedObject (readonly)

Returns the value of attribute last_modified.



53
54
55
# File 'lib/mini/guard.rb', line 53

def last_modified
  @last_modified
end

#pathObject (readonly)

Returns the value of attribute path.



53
54
55
# File 'lib/mini/guard.rb', line 53

def path
  @path
end

#sizeObject (readonly)

Returns the value of attribute size.



53
54
55
# File 'lib/mini/guard.rb', line 53

def size
  @size
end

Instance Method Details

#eql?(xfile) ⇒ Boolean

Returns:

  • (Boolean)


65
# File 'lib/mini/guard.rb', line 65

def eql?(xfile); self.path == xfile.path && self.last_modified == xfile.last_modified; end

#hashObject



64
# File 'lib/mini/guard.rb', line 64

def hash; "#{self.path}:#{self.last_modified}".hash; end

#to_sObject



63
# File 'lib/mini/guard.rb', line 63

def to_s; "file: #{path} size: #{size} last modified: #{last_modified} associations: #{associations}"; end