class FallCli::BrowserHelper

Attributes

position[RW]

Public Class Methods

new(items) click to toggle source
# File lib/fallcli/browser_helper.rb, line 5
def initialize items
  @files = Array.new
  items.each { |item| @files << item }
  @position = 0
end

Public Instance Methods

position_down() click to toggle source
# File lib/fallcli/browser_helper.rb, line 25
def position_down
  @position += 1 unless @position == (@files.size - 1)
end
position_up() click to toggle source
# File lib/fallcli/browser_helper.rb, line 21
def position_up
  @position -= 1 unless @position < 1
end
pretty_dropbox_file(file) click to toggle source
# File lib/fallcli/browser_helper.rb, line 17
def pretty_dropbox_file file
  "#{file.path} | #{file.mime_type} | #{file.size}"
end
show_files() click to toggle source
# File lib/fallcli/browser_helper.rb, line 11
def show_files
  @files.each_with_index.map do |item, index|
    position == index ? "[#{pretty_dropbox_file(item)}]" : " #{pretty_dropbox_file(item)} "
  end
end