Class: Archive

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

Constant Summary collapse

ROOT_PATH_FILE =
"./"
EXTENSION_FILE =
".txt"
MODE_WRITE =
"w"
FILE_PATH_KEYS =
"keys"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.


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

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.


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

def path
  @path
end

Instance Method Details

#decode(string) ⇒ Object

[View source]

35
36
37
# File 'lib/archive.rb', line 35

def decode(string)
  Base64.decode64(string)
end

#encode(string) ⇒ Object

[View source]

31
32
33
# File 'lib/archive.rb', line 31

def encode(string)
  Base64.encode64(string)
end

#full_nameObject

[View source]

23
24
25
26
27
28
29
# File 'lib/archive.rb', line 23

def full_name
  if FILE_PATH_KEYS
    Dir.mkdir(FILE_PATH_KEYS) unless Dir.exist?(FILE_PATH_KEYS)
  end

  "#{ FILE_PATH_KEYS + '/' if FILE_PATH_KEYS}#{@name || 'text'}#{EXTENSION_FILE}"
end

#readObject

[View source]

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

def read
  raise "Not implement"
end

#set_name(name) ⇒ Object

[View source]

19
20
21
# File 'lib/archive.rb', line 19

def set_name(name)
  @name = name
end

#writeObject

[View source]

15
16
17
# File 'lib/archive.rb', line 15

def write
  raise "Not implement"
end