Module: Card::Fetch::All

Included in:
Card
Defined in:
lib/card/fetch/all.rb

Overview

fetch-related Card instance methods

Instance Method Summary collapse

Instance Method Details

#fetch(field_marks, opts = {}) ⇒ Object

fetching from the context of a card



6
7
8
9
10
11
# File 'lib/card/fetch/all.rb', line 6

def fetch field_marks, opts={}
  opts[:new][:supercard] = self if opts[:new]
  Array.wrap(field_marks).inject(self) do |card, mark|
    Card.fetch card.name.field(mark.cardname), opts
  end
end

#newish(opts) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/card/fetch/all.rb', line 13

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

#refresh(force = false) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/card/fetch/all.rb', line 23

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