Class: ReactEmailRails::PropsResolver
- Inherits:
-
Object
- Object
- ReactEmailRails::PropsResolver
- Defined in:
- lib/react_email_rails/props_resolver.rb
Constant Summary collapse
- INTERNAL_ASSIGN_PREFIX =
"_"- RESERVED_ASSIGNS =
["params", "rendered_format"].freeze
Instance Method Summary collapse
-
#initialize(mailer) ⇒ PropsResolver
constructor
A new instance of PropsResolver.
- #resolve(react, props) ⇒ Object
Constructor Details
#initialize(mailer) ⇒ PropsResolver
Returns a new instance of PropsResolver.
5 6 7 |
# File 'lib/react_email_rails/props_resolver.rb', line 5 def initialize(mailer) @mailer = mailer end |
Instance Method Details
#resolve(react, props) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/react_email_rails/props_resolver.rb', line 9 def resolve(react, props) case react when String [react, props || {}] when Hash raise(ArgumentError, "Parameter `props` is not allowed when passing a Hash to `react`") if props [inferred_component, react] when true [inferred_component, assign_props] else raise(ArgumentError, "`react` must be a String, Hash, or true") end end |