Class: Gizzard::Transformation::Op::DiffShards
- Defined in:
- lib/gizzard/transformation_op.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
(also: #template)
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #apply(nameserver, table_id, base_id, table_prefix, translations) ⇒ Object
- #expand(*args) ⇒ Object
-
#initialize(from, to) ⇒ DiffShards
constructor
A new instance of DiffShards.
- #involved_shards(table_prefix, translations) ⇒ Object
Methods inherited from BaseOp
#<=>, #eql?, #inspect, #inverse?
Constructor Details
#initialize(from, to) ⇒ DiffShards
Returns a new instance of DiffShards.
74 75 76 77 |
# File 'lib/gizzard/transformation_op.rb', line 74 def initialize(from, to) @from = from @to = to end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
71 72 73 |
# File 'lib/gizzard/transformation_op.rb', line 71 def from @from end |
#to ⇒ Object (readonly) Also known as: template
Returns the value of attribute to.
71 72 73 |
# File 'lib/gizzard/transformation_op.rb', line 71 def to @to end |
Instance Method Details
#apply(nameserver, table_id, base_id, table_prefix, translations) ⇒ Object
85 86 87 88 89 90 |
# File 'lib/gizzard/transformation_op.rb', line 85 def apply(nameserver, table_id, base_id, table_prefix, translations) from_shard_id = from.to_shard_id(table_prefix, translations) to_shard_id = to.to_shard_id(table_prefix, translations) nameserver.diff_shards(from_shard_id, to_shard_id) end |
#expand(*args) ⇒ Object
79 |
# File 'lib/gizzard/transformation_op.rb', line 79 def (*args); { :repair => [self] } end |
#involved_shards(table_prefix, translations) ⇒ Object
81 82 83 |
# File 'lib/gizzard/transformation_op.rb', line 81 def involved_shards(table_prefix, translations) [to.to_shard_id(table_prefix, translations)] end |