Class: Paraphrase::Mapping Private
- Inherits:
-
Object
- Object
- Paraphrase::Mapping
- Defined in:
- lib/paraphrase/mapping.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #keys ⇒ Object readonly private
- #name ⇒ Object readonly private
- #required_keys ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(keys, options) ⇒ Mapping
constructor
private
A new instance of Mapping.
- #satisfied?(params) ⇒ Boolean private
- #values(params) ⇒ Object private
Constructor Details
#initialize(keys, options) ⇒ Mapping
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Mapping.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/paraphrase/mapping.rb', line 8 def initialize(keys, ) @keys = keys @name = [:to] @required_keys = if [:whitelist] == true [] else @keys - Array.wrap([:whitelist]) end end |
Instance Attribute Details
#keys ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/paraphrase/mapping.rb', line 6 def keys @keys end |
#name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/paraphrase/mapping.rb', line 6 def name @name end |
#required_keys ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/paraphrase/mapping.rb', line 6 def required_keys @required_keys end |
Instance Method Details
#satisfied?(params) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/paraphrase/mapping.rb', line 19 def satisfied?(params) required_keys.all? { |key| params[key] } end |
#values(params) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/paraphrase/mapping.rb', line 23 def values(params) keys.map { |key| params[key] } end |