Module: Faceter::Coercers Private
- Extended by:
- Transproc::Registry
- Defined in:
- lib/faceter/coercers.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Collection of functions to coerce command arguments to node attributes
Class Method Summary collapse
- .create(name = nil, **options) ⇒ Object private
- .exclude(*keys, **options) ⇒ Object private
- .field(key) ⇒ Object private
- .fold(**options) ⇒ Object private
- .prefix(prefix, **options) ⇒ Object private
- .rename(name, **options) ⇒ Object private
- .unfold(**options) ⇒ Object private
- .unwrap(*keys, **options) ⇒ Object private
- .wrap(*keys, **options) ⇒ Object private
Class Method Details
.create(name = nil, **options) ⇒ 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.
47 48 49 |
# File 'lib/faceter/coercers.rb', line 47 def self.create(name = nil, **) { name: name, keys: .fetch(:from) } end |
.exclude(*keys, **options) ⇒ 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.
41 42 43 44 |
# File 'lib/faceter/coercers.rb', line 41 def self.exclude(*keys, **) opts = keys.any? ? { only: keys } : { selector: Selector.new(opts) } end |
.field(key) ⇒ 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.
52 53 54 |
# File 'lib/faceter/coercers.rb', line 52 def self.field(key) { key: key } end |
.fold(**options) ⇒ 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.
57 58 59 |
# File 'lib/faceter/coercers.rb', line 57 def self.fold(**) { key: .fetch(:to) } end |
.prefix(prefix, **options) ⇒ 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.
14 15 16 17 18 19 |
# File 'lib/faceter/coercers.rb', line 14 def self.prefix(prefix, **) filter = .fetch(:separator) { "_" } nested = .fetch(:nested) { false } selector = Selector.new() if [:except] || [:only] { prefix: prefix, separator: filter, nested: nested, selector: selector } end |
.rename(name, **options) ⇒ 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.
62 63 64 |
# File 'lib/faceter/coercers.rb', line 62 def self.rename(name, **) { keys: { name => .fetch(:to) } } end |
.unfold(**options) ⇒ 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.
36 37 38 |
# File 'lib/faceter/coercers.rb', line 36 def self.unfold(**) { key: .fetch(:from) } end |
.unwrap(*keys, **options) ⇒ 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.
22 23 24 25 26 |
# File 'lib/faceter/coercers.rb', line 22 def self.unwrap(*keys, **) key = .fetch(:from) opts = (keys.any? ? { only: keys } : {}).merge() { key: key, selector: Selector.new(opts) } end |
.wrap(*keys, **options) ⇒ 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.
29 30 31 32 33 |
# File 'lib/faceter/coercers.rb', line 29 def self.wrap(*keys, **) key = .fetch(:to) opts = (keys.any? ? { only: keys } : {}).merge() { key: key, selector: Selector.new(opts) } end |