Class: S3Master::PolicyDiffer
- Inherits:
-
Object
- Object
- S3Master::PolicyDiffer
- Defined in:
- lib/s3_master/policy_differ.rb
Instance Attribute Summary collapse
-
#diff ⇒ Object
readonly
Returns the value of attribute diff.
-
#local ⇒ Object
readonly
Returns the value of attribute local.
-
#remote ⇒ Object
readonly
Returns the value of attribute remote.
Instance Method Summary collapse
- #compute_diff ⇒ Object
- #identical? ⇒ Boolean
-
#initialize(remote_policy, local_policy) ⇒ PolicyDiffer
constructor
A new instance of PolicyDiffer.
- #to_s ⇒ Object
Constructor Details
#initialize(remote_policy, local_policy) ⇒ PolicyDiffer
Returns a new instance of PolicyDiffer.
7 8 9 10 11 |
# File 'lib/s3_master/policy_differ.rb', line 7 def initialize(remote_policy, local_policy) @remote = remote_policy @local = local_policy compute_diff end |
Instance Attribute Details
#diff ⇒ Object (readonly)
Returns the value of attribute diff.
5 6 7 |
# File 'lib/s3_master/policy_differ.rb', line 5 def diff @diff end |
#local ⇒ Object (readonly)
Returns the value of attribute local.
5 6 7 |
# File 'lib/s3_master/policy_differ.rb', line 5 def local @local end |
#remote ⇒ Object (readonly)
Returns the value of attribute remote.
5 6 7 |
# File 'lib/s3_master/policy_differ.rb', line 5 def remote @remote end |
Instance Method Details
#compute_diff ⇒ Object
13 14 15 16 17 |
# File 'lib/s3_master/policy_differ.rb', line 13 def compute_diff rj = JSON.neat_generate(@remote, sort: true) lj = JSON.neat_generate(@local, sort: true) @diff = Diffy::Diff.new(rj, lj, context: 7, include_diff_info: true) end |
#identical? ⇒ Boolean
19 |
# File 'lib/s3_master/policy_differ.rb', line 19 def identical?() diff.to_s == "\n" ; end |
#to_s ⇒ Object
20 |
# File 'lib/s3_master/policy_differ.rb', line 20 def to_s() diff.to_s ; end |