Class: Hadupils::Assets::File

Inherits:
Object
  • Object
show all
Defined in:
lib/hadupils/assets.rb

Direct Known Subclasses

Archive, Jar

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ File

Returns a new instance of File.



13
14
15
16
# File 'lib/hadupils/assets.rb', line 13

def initialize(path)
  @path = path
  @name = self.class.determine_name(path)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/hadupils/assets.rb', line 3

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/hadupils/assets.rb', line 3

def path
  @path
end

Class Method Details

.determine_name(path) ⇒ Object



5
6
7
# File 'lib/hadupils/assets.rb', line 5

def self.determine_name(path)
  ::File.basename(path)
end

.hiverc_typeObject



9
10
11
# File 'lib/hadupils/assets.rb', line 9

def self.hiverc_type
  :FILE
end

Instance Method Details

#hidden?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/hadupils/assets.rb', line 18

def hidden?
  name[0] == '.'
end

#hiverc_commandObject



22
23
24
# File 'lib/hadupils/assets.rb', line 22

def hiverc_command
  "ADD #{self.class.hiverc_type} #{path};"
end