Class: Dommy::File
Overview
File — Blob with a filename and an optional last-modified
timestamp. Returned from <input type="file"> / drag-and-drop,
and accepted by FormData.
Instance Attribute Summary collapse
-
#last_modified ⇒ Object
readonly
Returns the value of attribute last_modified.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Blob
Instance Method Summary collapse
- #__js_get__(key) ⇒ Object
-
#initialize(parts, name, options = {}, window = nil) ⇒ File
constructor
A new instance of File.
Methods inherited from Blob
#__dommy_bytes__, #__js_call__, #array_buffer, #bytes, #slice, #text
Methods included from Bridge::Methods
Constructor Details
#initialize(parts, name, options = {}, window = nil) ⇒ File
Returns a new instance of File.
170 171 172 173 174 175 |
# File 'lib/dommy/blob.rb', line 170 def initialize(parts, name, = {}, window = nil) super(parts, , window) @name = name.to_s raw_lm = ["lastModified"] || [:lastModified] @last_modified = (raw_lm || (Time.now.to_f * 1000)).to_i end |
Instance Attribute Details
#last_modified ⇒ Object (readonly)
Returns the value of attribute last_modified.
168 169 170 |
# File 'lib/dommy/blob.rb', line 168 def last_modified @last_modified end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
168 169 170 |
# File 'lib/dommy/blob.rb', line 168 def name @name end |
Instance Method Details
#__js_get__(key) ⇒ Object
177 178 179 180 181 182 183 184 185 186 |
# File 'lib/dommy/blob.rb', line 177 def __js_get__(key) case key when "name" @name when "lastModified" @last_modified else super end end |