Class: Envoi::Aspera::WatchService::Client::SnapshotEntry

Inherits:
Hash
  • Object
show all
Defined in:
lib/envoi/aspera/watch_service/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ SnapshotEntry

Returns a new instance of SnapshotEntry.



34
35
36
37
# File 'lib/envoi/aspera/watch_service/client.rb', line 34

def initialize(data)
  # @attributes = data.is_a?(MatchData) ? { path: data[:path], stat_as_json: data[:stat_as_json] } : data
  merge! data
end

Class Method Details

.new_from_match_data(match_data) ⇒ Object



51
52
53
# File 'lib/envoi/aspera/watch_service/client.rb', line 51

def self.new_from_match_data(match_data)
  new(match_data.named_captures)
end

Instance Method Details

#pathObject



39
# File 'lib/envoi/aspera/watch_service/client.rb', line 39

def path; self[:path] end

#statObject



41
42
43
44
45
46
# File 'lib/envoi/aspera/watch_service/client.rb', line 41

def stat
  self[:stat] ||= begin
    json = self[:stat_as_json]
    JSON.parse(json) if json
  end
end

#stat_as_jsonObject



48
# File 'lib/envoi/aspera/watch_service/client.rb', line 48

def stat_as_json; self[:stat_as_json] end