Class: HammerCLI::Output::MetaData

Inherits:
Object
  • Object
show all
Defined in:
lib/hammer_cli/output/record_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ MetaData

Returns a new instance of MetaData.



8
9
10
11
12
13
14
15
16
17
# File 'lib/hammer_cli/output/record_collection.rb', line 8

def initialize(options={})
  @total = options[:total].to_i if options[:total]
  @subtotal = options[:subtotal].to_i if options[:subtotal]
  @page = options[:page].to_i if options[:page]
  @per_page = options[:per_page].to_i if options[:per_page]
  @search = options[:search]
  @sort_by = options[:sort_by]
  @sort_order = options[:sort_order]
  @pagination_verbosity = options[:pagination_verbosity] || HammerCLI::V_VERBOSE
end

Instance Attribute Details

#pageObject

Returns the value of attribute page.



6
7
8
# File 'lib/hammer_cli/output/record_collection.rb', line 6

def page
  @page
end

#pagination_verbosityObject

Returns the value of attribute pagination_verbosity.



6
7
8
# File 'lib/hammer_cli/output/record_collection.rb', line 6

def pagination_verbosity
  @pagination_verbosity
end

#per_pageObject

Returns the value of attribute per_page.



6
7
8
# File 'lib/hammer_cli/output/record_collection.rb', line 6

def per_page
  @per_page
end

#searchObject

Returns the value of attribute search.



6
7
8
# File 'lib/hammer_cli/output/record_collection.rb', line 6

def search
  @search
end

#sort_byObject

Returns the value of attribute sort_by.



6
7
8
# File 'lib/hammer_cli/output/record_collection.rb', line 6

def sort_by
  @sort_by
end

#sort_orderObject

Returns the value of attribute sort_order.



6
7
8
# File 'lib/hammer_cli/output/record_collection.rb', line 6

def sort_order
  @sort_order
end

#subtotalObject

Returns the value of attribute subtotal.



6
7
8
# File 'lib/hammer_cli/output/record_collection.rb', line 6

def subtotal
  @subtotal
end

#totalObject

Returns the value of attribute total.



6
7
8
# File 'lib/hammer_cli/output/record_collection.rb', line 6

def total
  @total
end

Instance Method Details

#pagination_set?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/hammer_cli/output/record_collection.rb', line 19

def pagination_set?
  !(@total.nil? || @subtotal.nil? || @page.nil? || @per_page.nil?)
end