Module: Card::Set::All::Chunk

Extended by:
Card::Set
Defined in:
tmpsets/set/mod003-core/all/chunk.rb

Overview

Set: All cards (Chunk)

Defined Under Namespace

Modules: Format

Class Method Summary collapse

Instance Method Summary collapse

Methods included from I18nScope

#mod_name, #scope

Methods included from Loader

#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set

Methods included from Helpers

#abstract_set?, #all_set?, #num_set_parts, #shortname, #underscore

Methods included from Card::Set::AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket, #unshift_basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Class Method Details

.source_locationObject



7
# File 'tmpsets/set/mod003-core/all/chunk.rb', line 7

def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/all/chunk.rb"; end

Instance Method Details

#chunks(content, type, named = false) ⇒ Object



9
10
11
12
13
14
# File 'tmpsets/set/mod003-core/all/chunk.rb', line 9

def chunks content, type, named=false
  content ||= self.content
  type ||= Card::Content::Chunk
  all_chunks = Card::Content.new(content, self).find_chunks type
  named ? all_chunks.select(&:referee_name) : all_chunks
end

#each_item_name_with_options(content = nil) ⇒ Object



30
31
32
33
34
35
# File 'tmpsets/set/mod003-core/all/chunk.rb', line 30

def each_item_name_with_options content=nil
  reference_chunks(content).each do |chunk|
    options = chunk.respond_to?(:options) ? chunk.options : {}
    yield chunk.referee_name, options
  end
end

named=true rejects external links (since the don't refer to a card name)



26
27
28
# File 'tmpsets/set/mod003-core/all/chunk.rb', line 26

def link_chunks content=nil, named=false
  chunks content, Card::Content::Chunk::Link, named
end

#nest_chunks(content = nil, named = true) ⇒ Object

named=true rejects commented nests



21
22
23
# File 'tmpsets/set/mod003-core/all/chunk.rb', line 21

def nest_chunks content=nil, named=true
  chunks content, Card::Content::Chunk::Nest, named
end

#reference_chunks(content = nil, named = true) ⇒ Object



16
17
18
# File 'tmpsets/set/mod003-core/all/chunk.rb', line 16

def reference_chunks content=nil, named=true
  chunks content, Card::Content::Chunk::Reference, named
end