Class: Gluey::Dependencies::SingleFile

Inherits:
Object
  • Object
show all
Defined in:
lib/gluey/dependencies/single_file.rb

Direct Known Subclasses

Directory, Handlebars_bundle, TextsBundle

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, **data) ⇒ SingleFile

Returns a new instance of SingleFile.



6
7
8
9
# File 'lib/gluey/dependencies/single_file.rb', line 6

def initialize(file, **data)
  @file = file
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/gluey/dependencies/single_file.rb', line 4

def data
  @data
end

#fileObject (readonly)

Returns the value of attribute file.



4
5
6
# File 'lib/gluey/dependencies/single_file.rb', line 4

def file
  @file
end

Instance Method Details

#==(other) ⇒ Object



24
25
26
# File 'lib/gluey/dependencies/single_file.rb', line 24

def ==(other)
  @file == other.file
end

#actualizeObject



11
12
13
14
# File 'lib/gluey/dependencies/single_file.rb', line 11

def actualize
  @mtime = File.mtime(@file).to_i
  self
end

#changed?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/gluey/dependencies/single_file.rb', line 16

def changed?
  File.mtime(@file).to_i != @mtime rescue true
end

#exists?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/gluey/dependencies/single_file.rb', line 20

def exists?
  File.exists? @file
end