Class: Scryfall::List

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/scryfall/list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents, klass) ⇒ List

Returns a new instance of List.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/scryfall/list.rb', line 6

def initialize(contents, klass)
  @has_more    = contents["has_more"]
  @next_page   = contents["next_page"]
  @total_cards = contents["total_cards"]
  @warnings    = contents["warnings"]

  data = contents["data"].map do |obj|
    klass.new obj.to_hash
  end

  super(data)
end

Instance Attribute Details

#has_moreObject (readonly)

Returns the value of attribute has_more.



4
5
6
# File 'lib/scryfall/list.rb', line 4

def has_more
  @has_more
end

#next_pageObject (readonly)

Returns the value of attribute next_page.



4
5
6
# File 'lib/scryfall/list.rb', line 4

def next_page
  @next_page
end

#total_cardsObject (readonly)

Returns the value of attribute total_cards.



4
5
6
# File 'lib/scryfall/list.rb', line 4

def total_cards
  @total_cards
end

#warningsObject (readonly)

Returns the value of attribute warnings.



4
5
6
# File 'lib/scryfall/list.rb', line 4

def warnings
  @warnings
end