Sha256: 284432bbf3323978c854ac2d921ec79c2a7d7c30e5aae7c4884b8d51d053a281
Contents?: true
Size: 756 Bytes
Versions: 6
Compression:
Stored size: 756 Bytes
Contents
# frozen-string-literal: true module Leftovers class DefinitionToAdd attr_reader :node, :name, :location def initialize(node, name: node.name, location: node.loc.name) @node = node @name = name @location = location end def privacy=(value) @node.privacy = value end def keep?(file_collector) @keep ||= file_collector.keep_line?(location.line) || ::Leftovers.config.keep === node end def test?(file_collector) file_collector.test_line?(location.line) || ::Leftovers.config.test_only === node end def to_definition(file_collector) return if keep?(file_collector) Leftovers::Definition.new(name, location: location, test: test?(file_collector)) end end end
Version data entries
6 entries across 6 versions & 1 rubygems