Module: Pina::Resource

Instance Method Summary collapse

Instance Method Details

#paginate(options = {}) ⇒ Object



3
4
5
# File 'lib/pina/resource.rb', line 3

def paginate(options = {})
  @per_page = options.fetch(:per_page)
end

#per_pageObject



18
19
20
# File 'lib/pina/resource.rb', line 18

def per_page
  @per_page || ::Pina.configuration.default_per_page
end

#resource_methods(*methods) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/pina/resource.rb', line 7

def resource_methods(*methods)
  methods.each do |method|
    next unless method

    method_name = "define_#{method}".to_sym
    next unless respond_to?(method_name, true)

    send(method_name)
  end
end