Sha256: 054d4ff419aec4933c44dea95a478b55da1c286c5467b4ca1317aba760d105f7

Contents?: true

Size: 727 Bytes

Versions: 17

Compression:

Stored size: 727 Bytes

Contents

module HammerCLI::Output


  class MetaData

    attr_accessor :total, :subtotal, :page, :per_page, :search, :sort_by, :sort_order

    def initialize(options={})
      @total = options[:total]
      @subtotal = options[:subtotal]
      @page = options[:page]
      @per_page = options[:per_page]
      @search = options[:search]
      @sort_by = options[:sort_by]
      @sort_order = options[:sort_order]
    end

  end


  class RecordCollection < Array

    attr_accessor :meta

    def initialize(data, options={})
      super [data].flatten(1)
      if options.has_key?(:meta) && options[:meta].class <= MetaData
        @meta = options[:meta]
      else
        @meta = MetaData.new(options)
      end
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
hammer_cli-0.6.1 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.6.0 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.5.1 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.4.0 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.3.0 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.2.0 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.1.4 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.1.3 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.1.2 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.1.1 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.1.0 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.0.18 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.0.16 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.0.15 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.0.14 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.0.13 lib/hammer_cli/output/record_collection.rb
hammer_cli-0.0.12 lib/hammer_cli/output/record_collection.rb