Sha256: 186e2cc5f0f78f59a34ee52634617514a3d03048938a52b4be97edbeda635a1a

Contents?: true

Size: 847 Bytes

Versions: 9

Compression:

Stored size: 847 Bytes

Contents

class Card
  class Fetch
    # fetch-related Card instance methods
    module All
      # fetching from the context of a card
      def fetch traits, opts={}
        opts[:new][:supercard] = self if opts[:new]
        Array.wrap(traits).inject(self) do |card, trait|
          Card.fetch card.name.trait(trait), opts
        end
      end

      def newish opts
        reset_patterns
        Card.with_normalized_new_args opts do |norm_opts|
          handle_type norm_opts do
            assign_attributes norm_opts
            self.name = name # trigger superize_name
          end
        end
      end

      def refresh force=false
        return self unless force || frozen? || readonly?
        return unless id

        fresh_card = self.class.find id
        fresh_card.include_set_modules
        fresh_card
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
card-1.103.4 lib/card/fetch/all.rb
card-1.103.3 lib/card/fetch/all.rb
card-1.103.2 lib/card/fetch/all.rb
card-1.103.1 lib/card/fetch/all.rb
card-1.103.0 lib/card/fetch/all.rb
card-1.101.7 lib/card/fetch/all.rb
card-1.102.0 lib/card/fetch/all.rb
card-1.101.6 lib/card/fetch/all.rb
card-1.101.5 lib/card/fetch/all.rb