Class: ExpressMailer::Image
- Inherits:
-
Object
- Object
- ExpressMailer::Image
- Defined in:
- lib/express_mailer/image.rb
Instance Attribute Summary collapse
-
#alt ⇒ Object
Returns the value of attribute alt.
-
#background ⇒ Object
Returns the value of attribute background.
-
#shape ⇒ Object
Returns the value of attribute shape.
-
#size ⇒ Object
Returns the value of attribute size.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #height ⇒ Object
-
#initialize(options = {}) ⇒ Image
constructor
A new instance of Image.
- #shape_class ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Image
Returns a new instance of Image.
13 14 15 16 17 18 19 |
# File 'lib/express_mailer/image.rb', line 13 def initialize( = {}) @url = .fetch(:url) @alt = .fetch(:alt) @background = .fetch(:background, 'transparent') @shape = .fetch(:shape, :normal) # :normal, :circle, :rounded @size = .fetch(:size, :normal) # :normal, :large end |
Instance Attribute Details
#alt ⇒ Object
Returns the value of attribute alt.
3 4 5 |
# File 'lib/express_mailer/image.rb', line 3 def alt @alt end |
#background ⇒ Object
Returns the value of attribute background.
3 4 5 |
# File 'lib/express_mailer/image.rb', line 3 def background @background end |
#shape ⇒ Object
Returns the value of attribute shape.
3 4 5 |
# File 'lib/express_mailer/image.rb', line 3 def shape @shape end |
#size ⇒ Object
Returns the value of attribute size.
3 4 5 |
# File 'lib/express_mailer/image.rb', line 3 def size @size end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/express_mailer/image.rb', line 3 def url @url end |
Class Method Details
.create(attrs) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/express_mailer/image.rb', line 5 def self.create(attrs) if attrs new(attrs) else nil end end |
Instance Method Details
#height ⇒ Object
25 26 27 |
# File 'lib/express_mailer/image.rb', line 25 def height @size.to_sym == :large ? 240 : 120 end |
#shape_class ⇒ Object
21 22 23 |
# File 'lib/express_mailer/image.rb', line 21 def shape_class "shape-#{shape}" end |