Class: Synco::Command::Rotation

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/synco/command/prune.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, time) ⇒ Rotation

Returns a new instance of Rotation.



22
23
24
25
# File 'lib/synco/command/prune.rb', line 22

def initialize(path, time)
	@path = path
	@time = time
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



28
29
30
# File 'lib/synco/command/prune.rb', line 28

def path
  @path
end

#timeObject (readonly)

Returns the value of attribute time.



27
28
29
# File 'lib/synco/command/prune.rb', line 27

def time
  @time
end

Instance Method Details

#<=>(other) ⇒ Object

Sort in reverse order by default



31
32
33
# File 'lib/synco/command/prune.rb', line 31

def <=> other
	other.time <=> @time
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
38
39
40
41
42
# File 'lib/synco/command/prune.rb', line 35

def eql? other
	case other
	when Rotation
		@path.eql?(other.path)
	else
		@path.eql?(other.to_s)
	end
end

#hashObject



44
45
46
# File 'lib/synco/command/prune.rb', line 44

def hash
	@path.hash
end

#to_sObject



48
49
50
# File 'lib/synco/command/prune.rb', line 48

def to_s
	@path
end