Class: Envoi::Aspera::WatchService::Client::SnapshotEntry
- Inherits:
-
Hash
- Object
- Hash
- Envoi::Aspera::WatchService::Client::SnapshotEntry
- Defined in:
- lib/envoi/aspera/watch_service/client.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ SnapshotEntry
constructor
A new instance of SnapshotEntry.
- #path ⇒ Object
- #stat ⇒ Object
- #stat_as_json ⇒ Object
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
#path ⇒ Object
39 |
# File 'lib/envoi/aspera/watch_service/client.rb', line 39 def path; self[:path] end |
#stat ⇒ Object
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_json ⇒ Object
48 |
# File 'lib/envoi/aspera/watch_service/client.rb', line 48 def stat_as_json; self[:stat_as_json] end |