Class: Browser::FileList
- Includes:
- Enumerable
- Defined in:
- lib/browser/file_list.rb
Defined Under Namespace
Classes: File
Instance Method Summary collapse
-
#[](index) ⇒ Browser::FileList::File
The file at the specified index.
-
#each {|file| ... } ⇒ Object
Call the given block for each file in the list.
-
#initialize(native) ⇒ FileList
constructor
A new instance of FileList.
-
#length ⇒ Integer
(also: #size)
The number of files in this list.
-
#to_a ⇒ Object
(also: #to_ary)
Convert this FileList into an array.
-
#to_s ⇒ String
A string representation of this FileList.
Constructor Details
Instance Method Details
#[](index) ⇒ Browser::FileList::File
Returns the file at the specified index.
15 16 17 |
# File 'lib/browser/file_list.rb', line 15 def [] index @files[index] end |
#each {|file| ... } ⇒ Object
Call the given block for each file in the list
28 29 30 31 32 |
# File 'lib/browser/file_list.rb', line 28 def each &block @files.each do |file| block.call file end end |
#length ⇒ Integer Also known as: size
Returns the number of files in this list.
20 21 22 |
# File 'lib/browser/file_list.rb', line 20 def length `#@native.length` end |
#to_a ⇒ Object Also known as: to_ary
Convert this FileList into an array
35 36 37 |
# File 'lib/browser/file_list.rb', line 35 def to_a @files.dup # Don't return a value that can mutate our internal state end |
#to_s ⇒ String
Returns a string representation of this FileList.
41 42 43 |
# File 'lib/browser/file_list.rb', line 41 def to_s @files.to_s end |