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.



51
52
53
54
55
# File 'lib/s3ranger/sync.rb', line 51

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

Instance Attribute Details

#baseObject

Returns the value of attribute base.



47
48
49
# File 'lib/s3ranger/sync.rb', line 47

def base
  @base
end

#pathObject

Returns the value of attribute path.



48
49
50
# File 'lib/s3ranger/sync.rb', line 48

def path
  @path
end

#sizeObject

Returns the value of attribute size.



49
50
51
# File 'lib/s3ranger/sync.rb', line 49

def size
  @size
end

Instance Method Details

#<=>(other) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/s3ranger/sync.rb', line 65

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

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



61
62
63
# File 'lib/s3ranger/sync.rb', line 61

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

#fullObject



57
58
59
# File 'lib/s3ranger/sync.rb', line 57

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