Class: RubyRich::Attachment
- Inherits:
-
Object
- Object
- RubyRich::Attachment
- Defined in:
- lib/ruby_rich/attachment.rb
Instance Attribute Summary collapse
-
#display_name ⇒ Object
Returns the value of attribute display_name.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#mime_type ⇒ Object
Returns the value of attribute mime_type.
-
#path ⇒ Object
Returns the value of attribute path.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, path:, mime_type: nil, display_name: nil, metadata: {}) ⇒ Attachment
constructor
A new instance of Attachment.
- #to_h ⇒ Object
Constructor Details
#initialize(type:, path:, mime_type: nil, display_name: nil, metadata: {}) ⇒ Attachment
Returns a new instance of Attachment.
7 8 9 10 11 12 13 |
# File 'lib/ruby_rich/attachment.rb', line 7 def initialize(type:, path:, mime_type: nil, display_name: nil, metadata: {}) @type = type.to_sym @path = path.to_s @mime_type = mime_type @display_name = display_name || File.basename(@path) @metadata = .dup end |
Instance Attribute Details
#display_name ⇒ Object
Returns the value of attribute display_name.
5 6 7 |
# File 'lib/ruby_rich/attachment.rb', line 5 def display_name @display_name end |
#metadata ⇒ Object
Returns the value of attribute metadata.
5 6 7 |
# File 'lib/ruby_rich/attachment.rb', line 5 def @metadata end |
#mime_type ⇒ Object
Returns the value of attribute mime_type.
5 6 7 |
# File 'lib/ruby_rich/attachment.rb', line 5 def mime_type @mime_type end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/ruby_rich/attachment.rb', line 5 def path @path end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/ruby_rich/attachment.rb', line 5 def type @type end |
Instance Method Details
#to_h ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/ruby_rich/attachment.rb', line 15 def to_h { type: @type, path: @path, mime_type: @mime_type, display_name: @display_name, metadata: @metadata }.compact end |