Class: Avm::Data::Dumper

Inherits:
Performer show all
Defined in:
lib/avm/data/dumper.rb

Constant Summary collapse

DEFAULT_EXPIRE_TIME =
1.day
DEFAULT_OVERWRITE =
false
DEFAULT_ROTATE =
true

Instance Method Summary collapse

Methods inherited from Performer

#immutable_constructor_args, #perform, #performable?

Instance Method Details

#cannot_perform_reasonnil

Returns:

  • (nil)


21
22
23
# File 'lib/avm/data/dumper.rb', line 21

def cannot_perform_reason
  nil
end

#default_dump_pathPathname

Returns:

  • (Pathname)


26
27
28
29
30
31
# File 'lib/avm/data/dumper.rb', line 26

def default_dump_path
  r = data_owner.data_default_dump_path
  include_excludes_path_suffix.if_present(r) do |v|
    r.basename_sub('.*') { |b| "#{b}#{v}#{r.extname}" }
  end
end

#target_path_expired?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/avm/data/dumper.rb', line 34

def target_path_expired?
  target_path_time.if_present(true) { |v| v >= expire_time }
end

#target_path_timeActiveSupport::Duration?

Returns:

  • (ActiveSupport::Duration, nil)


39
40
41
# File 'lib/avm/data/dumper.rb', line 39

def target_path_time
  target_path.exist? ? ::Time.now - ::File.mtime(target_path) : nil
end