Class: Spree::Emails::EditableTemplates::Definition
- Inherits:
-
Object
- Object
- Spree::Emails::EditableTemplates::Definition
- Defined in:
- lib/spree/emails/editable_templates.rb
Overview
One editable template.
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#sample ⇒ Object
readonly
Returns the value of attribute sample.
Instance Method Summary collapse
- #email? ⇒ Boolean
-
#initialize(key:, kind:, sample: nil) ⇒ Definition
constructor
A new instance of Definition.
- #sample_class ⇒ Class?
Constructor Details
#initialize(key:, kind:, sample: nil) ⇒ Definition
Returns a new instance of Definition.
26 27 28 29 30 31 32 |
# File 'lib/spree/emails/editable_templates.rb', line 26 def initialize(key:, kind:, sample: nil) raise ArgumentError, "Unknown email template kind: #{kind.inspect}" unless KINDS.include?(kind) @key = key @kind = kind @sample = sample end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
21 22 23 |
# File 'lib/spree/emails/editable_templates.rb', line 21 def key @key end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
21 22 23 |
# File 'lib/spree/emails/editable_templates.rb', line 21 def kind @kind end |
#sample ⇒ Object (readonly)
Returns the value of attribute sample.
21 22 23 |
# File 'lib/spree/emails/editable_templates.rb', line 21 def sample @sample end |
Instance Method Details
#email? ⇒ Boolean
34 35 36 |
# File 'lib/spree/emails/editable_templates.rb', line 34 def email? kind == :email end |
#sample_class ⇒ Class?
39 40 41 |
# File 'lib/spree/emails/editable_templates.rb', line 39 def sample_class sample&.constantize end |