class Cumulus::S3::GrantDiff

Public: Represents a single difference between local configuration and an AWS Grant.

Public Class Methods

new(type, aws = nil, local = nil) click to toggle source
Calls superclass method Cumulus::Common::Diff::new
# File lib/s3/models/GrantDiff.rb, line 19
def initialize(type, aws = nil, local = nil)
  super(type, aws, local)

  if aws and local
    @permissions = Common::ListChange.new(
      local.permissions - aws.permissions,
      aws.permissions - local.permissions
    )
  end
end

Public Instance Methods

asset_type() click to toggle source
# File lib/s3/models/GrantDiff.rb, line 30
def asset_type
  "Grant"
end
aws_name() click to toggle source
# File lib/s3/models/GrantDiff.rb, line 34
def aws_name
  @aws.name
end
diff_string() click to toggle source
# File lib/s3/models/GrantDiff.rb, line 38
def diff_string
  case @type
  when PERMISSIONS
    [
      "#{@local.name}:",
      @permissions.removed.map { |p| Colors.removed("\t#{p}") },
      @permissions.added.map { |p| Colors.added("\t#{p}") },
    ].flatten.join("\n")
  end
end