Class: Texd::Attachment::Base
- Inherits:
-
Object
- Object
- Texd::Attachment::Base
- Defined in:
- lib/texd/attachment.rb
Instance Attribute Summary collapse
-
#absolute_path ⇒ Object
readonly
absolute path to attachment on local file system.
Instance Method Summary collapse
-
#initialize(path, rename, serial) ⇒ Base
constructor
private
A new instance of Base.
-
#name(with_extension = true) ⇒ String
Returns the (renamed) output file name.
Constructor Details
#initialize(path, rename, serial) ⇒ Base
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 Base.
198 199 200 201 202 203 204 205 206 207 |
# File 'lib/texd/attachment.rb', line 198 def initialize(path, rename, serial) @absolute_path = path. @name = case rename when true then format("att%04d%s", serial, path.extname) when false then path.basename.to_s when String then rename else raise RenameError, rename end end |
Instance Attribute Details
#absolute_path ⇒ Object (readonly)
absolute path to attachment on local file system
191 192 193 |
# File 'lib/texd/attachment.rb', line 191 def absolute_path @absolute_path end |
Instance Method Details
#name(with_extension = true) ⇒ String
Returns the (renamed) output file name. When ‘with_extension` is `true`, the file extension is chopped.
214 215 216 |
# File 'lib/texd/attachment.rb', line 214 def name(with_extension = true) # rubocop:disable Style/OptionalBooleanParameter Attachment.name(@name, with_extension) end |