Class: UrlFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/finviz_rails/url_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(auth, page, params, row_limit) ⇒ UrlFormatter

Returns a new instance of UrlFormatter.



2
3
4
5
6
7
# File 'lib/finviz_rails/url_formatter.rb', line 2

def initialize(auth, page, params, row_limit)
  @auth = auth
  @page = page
  @params = params
  @row_limit = row_limit
end

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
# File 'lib/finviz_rails/url_formatter.rb', line 9

def run
  if @page
    stock_num = ((@page * @row_limit) + 1) - @row_limit
  else
    stock_num = 0
  end
  "#{url}&r=#{stock_num}"
end