Class: TheFox::MBDB::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/mbdb/record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRecord

Returns a new instance of Record.


14
15
16
17
18
19
# File 'lib/mbdb/record.rb', line 14

def initialize
	@domain_name = ''
	@domain = nil
	@path = ''
	@file_size = 0
end

Instance Attribute Details

#domainObject

Returns the value of attribute domain.


10
11
12
# File 'lib/mbdb/record.rb', line 10

def domain
  @domain
end

#file_sizeObject

Returns the value of attribute file_size.


12
13
14
# File 'lib/mbdb/record.rb', line 12

def file_size
  @file_size
end

#pathObject

Returns the value of attribute path.


11
12
13
# File 'lib/mbdb/record.rb', line 11

def path
  @path
end

Instance Method Details

#is_file?Boolean

Returns:

  • (Boolean)

32
33
34
# File 'lib/mbdb/record.rb', line 32

def is_file?
	@file_size > 0
end

#src_file_nameObject


28
29
30
# File 'lib/mbdb/record.rb', line 28

def src_file_name
	Pathname.new(Digest::SHA1.hexdigest("#{@domain_name}-#{@path}"))
end

#to_sObject


36
37
38
# File 'lib/mbdb/record.rb', line 36

def to_s
	"#{@domain}@#{@path}"
end