lib/github_api/arguments.rb in github_api-0.9.1 vs lib/github_api/arguments.rb in github_api-0.9.2

- old
+ new

@@ -6,10 +6,12 @@ include Normalizer include ParameterFilter include Validations + AUTO_PAGINATION = 'auto_pagination'.freeze + # Parameters passed to request attr_reader :params attr_reader :remaining @@ -52,10 +54,11 @@ # Arguments are inside the parameters hash parse_options options end @params = options @remaining = extract_remaining(args) + extract_pagination(options) yield_or_eval(&block) self end # Remove unkown keys from parameters hash. @@ -96,9 +99,17 @@ # Find remaining arguments # def extract_remaining(args) args[required.size..-1] + end + + # Fine auto_pagination parameter in options hash + # + def extract_pagination(options) + if (value = options.delete(AUTO_PAGINATION)) + api.auto_pagination = value + end end # Remove required arguments from parameters and # validate their presence(if not nil or empty string). #