class Convection::Model::Diff
Difference between an item in two templates
Unfortunately, there are a lot of resources to include in this array, and rather than parsing out only the ones that we need right now and potentially missing it in the future, just disable rubocop whining about that particular error: rubocop:disable ClassLength
Constants
- REPLACE_PROPERTIES
Properties for which a change requires a replacement (as opposed to an in-place update) Create/update this list with tmp/process_html.sh
Attributes
action[RW]
key[R]
ours[R]
theirs[R]
Public Class Methods
new(key, ours, theirs)
click to toggle source
# File lib/convection/model/diff.rb, line 19 def initialize(key, ours, theirs) @key = key @ours = ours @theirs = theirs @action = if ours && theirs property_name = key[/AWS::[A-Za-z0-9:]+\.[A-Za-z0-9]+/] if REPLACE_PROPERTIES.include?(property_name) :replace else :update end elsif ours :create else :delete end end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/convection/model/diff.rb, line 50 def <=>(other) value = @key <=> other.key return value if value != 0 value = @ours <=> other.ours return value if value != 0 value = @theirs <=> other.theirs return value if value != 0 @action <=> other.action end
to_thor()
click to toggle source
# File lib/convection/model/diff.rb, line 38 def to_thor message = case action when :create then "#{ key }: #{ ours }" when :update then "#{ key }: #{ theirs } => #{ ours }" when :replace then "#{ key }: #{ theirs } => #{ ours }" when :delete then key when :retain then key end [action, message, color] end