Class: S3Ranger::Node

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/s3ranger/sync.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base, path, size) ⇒ Node

Returns a new instance of Node.



77
78
79
80
81
# File 'lib/s3ranger/sync.rb', line 77

def initialize base, path, size
  @base = base.squeeze '/'
  @path = path.squeeze '/'
  @size = size
end

Instance Attribute Details

#baseObject

Returns the value of attribute base.



73
74
75
# File 'lib/s3ranger/sync.rb', line 73

def base
  @base
end

#pathObject

Returns the value of attribute path.



74
75
76
# File 'lib/s3ranger/sync.rb', line 74

def path
  @path
end

#sizeObject

Returns the value of attribute size.



75
76
77
# File 'lib/s3ranger/sync.rb', line 75

def size
  @size
end

Instance Method Details

#<=>(other) ⇒ Object



91
92
93
94
95
96
97
98
99
# File 'lib/s3ranger/sync.rb', line 91

def <=> other
  if self.size < other.size
    -1
  elsif self.size > other.size
    1
  else
    0
  end
end

#==(other) ⇒ Object Also known as: eql?



87
88
89
# File 'lib/s3ranger/sync.rb', line 87

def == other
  full == other.full and @size == other.size
end

#fullObject



83
84
85
# File 'lib/s3ranger/sync.rb', line 83

def full
  S3Ranger.safe_join [@base, @path]
end