Class: ODDB::Html::State::Drugs::Downloads::FileInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/oddb/html/state/drugs/downloads.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ FileInfo

Returns a new instance of FileInfo.



11
12
13
# File 'lib/oddb/html/state/drugs/downloads.rb', line 11

def initialize name
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/oddb/html/state/drugs/downloads.rb', line 10

def name
  @name
end

Instance Method Details

#file_pathObject



14
15
16
# File 'lib/oddb/html/state/drugs/downloads.rb', line 14

def file_path
  File.join ODDB.config.export_dir, @name
end

#price(times = 1) ⇒ Object



17
18
19
# File 'lib/oddb/html/state/drugs/downloads.rb', line 17

def price times=1
  ODDB.config.prices["org.oddb.de.download.#{times}"][name]
end

#sizeObject



20
21
22
# File 'lib/oddb/html/state/drugs/downloads.rb', line 20

def size
  File.size uncompressed? ? file_path : file_path + '.gz'
end

#uncompressed?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/oddb/html/state/drugs/downloads.rb', line 23

def uncompressed?
  ODDB.config.download_uncompressed.include? name
end