Method: Leaflet::Collection#initialize
- Defined in:
- lib/leaflet/collection.rb
#initialize(*args) ⇒ Collection
––––––––––––––Initialization ––––––––––––––
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/leaflet/collection.rb', line 15 def initialize(*args) @success = true if args.size == 1 # An Array was passed in. "Convert" it to a Collection. replace args.shift elsif args.size == 2 # Someone is building a custom Paginator, let's fetch the data. = args.pop records = Array(args.shift) replace records @current_page = [:page] @per_page = [:per_page] @total_entries = [:total] || self.size else raise ArgumentError end end |