Class: Hatenablog::Entries

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/hatenablog/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, page = 0, fetch = :partial) ⇒ Entries

Returns a new instance of Entries.



211
212
213
214
215
# File 'lib/hatenablog/client.rb', line 211

def initialize(client, page = 0, fetch = :partial)
  @client = client
  @page = page
  @fetch = fetch
end

Instance Method Details

#each(&block) ⇒ Object



217
218
219
220
221
222
223
224
225
226
# File 'lib/hatenablog/client.rb', line 217

def each(&block)
  return enum_for unless block_given?

  # @type var block: ^(Entry) -> void
  if @fetch == :all
    each_all(&block)
  else
    each_partial(&block)
  end
end