Sha256: 51fd8e1d0088edeca4c10efadec9edddfa31f3bbf85274aca78081d0ec1c3165
Contents?: true
Size: 1.25 KB
Versions: 9
Compression:
Stored size: 1.25 KB
Contents
module RspecApiDocumentation class Example attr_reader :example, :configuration def initialize(example, configuration) @example = example @configuration = configuration end def method_missing(method_sym, *args, &block) if example.metadata.has_key?(method_sym) example.metadata[method_sym] else example.send(method_sym, *args, &block) end end def respond_to?(method_sym, include_private = false) super || example.metadata.has_key?(method_sym) || example.respond_to?(method_sym, include_private) end def http_method metadata[:method].to_s.upcase end def should_document? return false if pending? || !metadata[:resource_name] || !metadata[:document] return true if configuration.filter == :all return false if (Array(metadata[:document]) & Array(configuration.exclusion_filter)).length > 0 return true if (Array(metadata[:document]) & Array(configuration.filter)).length > 0 end def public? metadata[:public] end def has_parameters? respond_to?(:parameters) && parameters.present? end def explanation metadata[:explanation] || nil end def requests metadata[:requests] || [] end end end
Version data entries
9 entries across 9 versions & 1 rubygems