diff options
| author | mokha <mokha@cisco.com> | 2018-03-09 18:55:39 -0700 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2018-03-09 18:55:39 -0700 |
| commit | d4c91d638f95a4e1c70df22197d5dc1df6b5a094 (patch) | |
| tree | 497edd81c45542da4ab0a3694c11fca65d66eb8e | |
| parent | 7f8726b4e8fa16b689e9bfc450bb61f747ef35ca (diff) | |
reduce ABC of method.
| -rw-r--r-- | .rubocop.yml | 6 | ||||
| -rw-r--r-- | lib/saml/kit/core_ext/assertion.rb | 24 |
2 files changed, 21 insertions, 9 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 01b2c56..346e8ac 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -68,6 +68,12 @@ Style/EachWithObject: Style/StringLiterals: EnforcedStyle: 'single_quotes' +Style/TrailingCommaInArrayLiteral: + Enabled: false + +Style/TrailingCommaInHashLiteral: + Enabled: false + RSpec/MultipleExpectations: Enabled: false diff --git a/lib/saml/kit/core_ext/assertion.rb b/lib/saml/kit/core_ext/assertion.rb index d02db0a..36587fe 100644 --- a/lib/saml/kit/core_ext/assertion.rb +++ b/lib/saml/kit/core_ext/assertion.rb @@ -1,16 +1,22 @@ module Saml module Kit class Assertion + TABLE = { + 'Assertion Present?' => ->(x) { x.present? }, + 'Issuer' => ->(x) { x.issuer }, + 'Name Id' => ->(x) { x.name_id }, + 'Attributes' => ->(x) { x.attributes.inspect }, + 'Not Before' => ->(x) { x.started_at }, + 'Not After' => ->(x) { x.expired_at }, + 'Audiences' => ->(x) { x.audiences.inspect }, + 'Encrypted?' => ->(x) { x.encrypted? }, + 'Decryptable' => ->(x) { x.decryptable? }, + }.freeze + def build_table(table = []) - table.push(['Assertion Present?', present?]) - table.push(['Issuer', issuer]) - table.push(['Name Id', name_id]) - table.push(['Attributes', attributes.inspect]) - table.push(['Not Before', started_at]) - table.push(['Not After', expired_at]) - table.push(['Audiences', audiences.inspect]) - table.push(['Encrypted?', encrypted?]) - table.push(['Decryptable', decryptable?]) + TABLE.each do |key, callable| + table.push([key, callable.call(self)]) + end signature.build_table(table) end end |
