Sha256: c8d6f80734495164fab54e6c26d35ada97954f13b2a4e35b20fb1e1a599e3964
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
require_relative "upstream_record_finder" module Satisfactory # Represents a collection of homogenous records. class Collection < Array # @api private def initialize(*args, upstream:, **kwargs, &block) super(*args, **kwargs, &block) @upstream = upstream end # @api private attr_reader :upstream # @!method and # Delegates to the upstream record. # @return (see Satisfactory::Record#and) # @see Satisfactory::Record#and # @!method create # Delegates to the upstream record. # @return (see Satisfactory::Record#create) # @see Satisfactory::Record#create # @!method to_plan # Delegates to the upstream record. # @return (see Satisfactory::Record#to_plan) # @see Satisfactory::Record#to_plan delegate :and, :create, :to_plan, to: :upstream # Calls {#with} on each entry in the collection. # # @return [Satisfactory::Collection] def with(...) self.class.new(map { |entry| entry.with(...) }, upstream:) end alias each_with with # Calls {#which_is} on each entry in the collection. # # @param (see Satisfactory::Record#which_is) # @return [Satisfactory::Collection] def which_are(...) self.class.new(map { |entry| entry.which_is(...) }, upstream:) end alias which_is which_are # (see Satisfactory::Record#and_same) def and_same(upstream_type) Satisfactory::UpstreamRecordFinder.new(upstream:).find(upstream_type) end alias return_to and_same # @api private def build flat_map(&:build) end # @api private def build_plan flat_map(&:build_plan) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
satisfactory-0.3.2 | lib/satisfactory/collection.rb |