Class: Surrealist::Carrier Private
- Inherits:
-
Object
- Object
- Surrealist::Carrier
- Defined in:
- lib/surrealist/carrier.rb
Overview
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.
A data structure to carry arguments across methods.
Constant Summary collapse
- BOOLEANS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[true, false, nil].freeze
Instance Attribute Summary collapse
- #camelize ⇒ Object private
- #include_namespaces ⇒ Object private
- #include_root ⇒ Object private
- #namespaces_nesting_level ⇒ Object private
- #root ⇒ Object private
Class Method Summary collapse
-
.call(**args) ⇒ Carrier
private
Public wrapper for Carrier.
Instance Method Summary collapse
-
#initialize(**args) ⇒ Carrier
constructor
private
A new instance of Carrier.
-
#no_args_provided? ⇒ Boolean
private
Checks if all arguments are set to default.
-
#parameters ⇒ Hash
private
Returns all arguments.
-
#sanitize! ⇒ Carrier
private
Performs type checks.
Constructor Details
#initialize(**args) ⇒ Carrier
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 Carrier.
28 29 30 31 32 33 34 |
# File 'lib/surrealist/carrier.rb', line 28 def initialize(**args) @camelize = args.delete(:camelize) || false @include_root = args.delete(:include_root) || false @include_namespaces = args.delete(:include_namespaces) || false @root = args.delete(:root) || nil @namespaces_nesting_level = args.delete(:namespaces_nesting_level) || DEFAULT_NESTING_LEVEL end |
Instance Attribute Details
#camelize ⇒ 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.
9 10 11 |
# File 'lib/surrealist/carrier.rb', line 9 def camelize @camelize end |
#include_namespaces ⇒ 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.
9 10 11 |
# File 'lib/surrealist/carrier.rb', line 9 def include_namespaces @include_namespaces end |
#include_root ⇒ 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.
9 10 11 |
# File 'lib/surrealist/carrier.rb', line 9 def include_root @include_root end |
#namespaces_nesting_level ⇒ 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.
9 10 11 |
# File 'lib/surrealist/carrier.rb', line 9 def namespaces_nesting_level @namespaces_nesting_level end |
#root ⇒ 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.
9 10 11 |
# File 'lib/surrealist/carrier.rb', line 9 def root @root end |
Class Method Details
.call(**args) ⇒ Carrier
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.
Public wrapper for Carrier.
24 25 26 |
# File 'lib/surrealist/carrier.rb', line 24 def self.call(**args) new(args).sanitize! end |
Instance Method Details
#no_args_provided? ⇒ 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.
Checks if all arguments are set to default
48 49 50 |
# File 'lib/surrealist/carrier.rb', line 48 def no_args_provided? @no_args_provided ||= no_args_provided end |
#parameters ⇒ Hash
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 all arguments
55 56 57 58 |
# File 'lib/surrealist/carrier.rb', line 55 def parameters { camelize: camelize, include_root: include_root, include_namespaces: include_namespaces, root: root, namespaces_nesting_level: namespaces_nesting_level } end |
#sanitize! ⇒ Carrier
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.
Performs type checks
39 40 41 42 43 44 45 |
# File 'lib/surrealist/carrier.rb', line 39 def sanitize! check_booleans! check_namespaces_nesting! check_root! strip_root! self end |