Sha256: 4008c3ad32989bea1c1fc52c886ebff211b9b4d81a64654a3d4c49fa23160017
Contents?: true
Size: 1.33 KB
Versions: 8
Compression:
Stored size: 1.33 KB
Contents
module Inch module Codebase # ObjectsFilter can be used to filter a list of objects by given a set of # given +options+ class ObjectsFilter attr_reader :options def initialize(list, options) @list = list @options = options filter end def objects @list end private def filter filter_namespaces filter_undocumented filter_depth filter_visibility end def filter_namespaces if options.namespaces == :only @list = @list.select(&:namespace?) elsif options.namespaces == :none @list = @list.reject(&:namespace?) end end def filter_undocumented if options.undocumented == :only @list = @list.select(&:undocumented?) elsif options.undocumented == :none @list = @list.reject(&:undocumented?) end end def filter_depth if options.depth @list = @list.select { |o| o.depth <= options.depth } end end def filter_visibility @list = @list.select do |o| options.visibility.include?(o.visibility) end if !options.visibility.include?(:private) @list = @list.reject do |o| o.private_tag? end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems