Class: Dabcup::Storage::Dump
- Inherits:
-
Object
- Object
- Dabcup::Storage::Dump
- Defined in:
- lib/dabcup/storage/dump.rb
Constant Summary collapse
- IGNORED_NAMES =
%w(. ..).freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#size ⇒ Object
Returns the value of attribute size.
Class Method Summary collapse
Instance Method Summary collapse
- #==(dump) ⇒ Object
- #created_at ⇒ Object
-
#initialize(attrs = {}) ⇒ Dump
constructor
A new instance of Dump.
- #valid? ⇒ Boolean
Constructor Details
#initialize(attrs = {}) ⇒ Dump
Returns a new instance of Dump.
13 14 15 16 |
# File 'lib/dabcup/storage/dump.rb', line 13 def initialize(attrs = {}) self.name = attrs[:name] self.size = attrs[:size] end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/dabcup/storage/dump.rb', line 6 def name @name end |
#size ⇒ Object
Returns the value of attribute size.
7 8 9 |
# File 'lib/dabcup/storage/dump.rb', line 7 def size @size end |
Class Method Details
.valid_name?(name) ⇒ Boolean
9 10 11 |
# File 'lib/dabcup/storage/dump.rb', line 9 def self.valid_name?(name) !IGNORED_NAMES.include?(name) end |
Instance Method Details
#==(dump) ⇒ Object
24 25 26 |
# File 'lib/dabcup/storage/dump.rb', line 24 def ==(dump) dump && name == dump.name && size == dump.size end |
#created_at ⇒ Object
18 19 20 21 22 |
# File 'lib/dabcup/storage/dump.rb', line 18 def created_at Time.parse(name) rescue ArgumentError nil # Invalid date => ignore file name end |
#valid? ⇒ Boolean
28 29 30 |
# File 'lib/dabcup/storage/dump.rb', line 28 def valid? self.class.valid_name?(name) && created_at != nil end |