Class: Jsb3::File

Inherits:
Object
  • Object
show all
Defined in:
lib/jsb3/file.rb

Instance Method Summary collapse

Constructor Details

#initialize(raw_file_hash, resources) ⇒ File

Returns a new instance of File.



3
4
5
6
7
8
# File 'lib/jsb3/file.rb', line 3

def initialize(raw_file_hash, resources)
  path = raw_file_hash['path']
  path = resources.apply(path)
  @path = path
  @name = raw_file_hash['name']
end

Instance Method Details

#absolute_pathObject



30
31
32
# File 'lib/jsb3/file.rb', line 30

def absolute_path
  ::File.absolute_path(to_s)
end

#basenameObject Also known as: name



16
17
18
# File 'lib/jsb3/file.rb', line 16

def basename
  ::File.basename(to_path)
end

#dirnameObject Also known as: path



10
11
12
# File 'lib/jsb3/file.rb', line 10

def dirname
  ::File.dirname(to_path)
end

#exists?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/jsb3/file.rb', line 26

def exists?
  ::File.exists?(to_s)
end

#to_sObject



22
23
24
# File 'lib/jsb3/file.rb', line 22

def to_s
  "#{dirname}/#{basename}"
end