Top Level Namespace

Defined Under Namespace

Modules: ActiveRecord, Cardio, CarrierWave, SetPatternSpecHelper, SpecHelper Classes: Card, FileUploader, Hash, ImageUploader, Module, Object

Constant Summary collapse

A_JOINEES =
["B", "C", "D", "E", "F"]
CARDS_MATCHING_TWO =
["Two","One+Two","One+Two+Three","Joe User"].sort
EXAMPLES =
{
  :nests => {
    :content  =>
      [
        "Some Literals: \\[{I'm not| a link]}, and ",
        "\\{{This Card|Is not Included}}",
        ", but ",
        "{{this is}}",
        ", and some tail"
      ].join(''),
    :rendered =>
      [
        "Some Literals: \\[{I'm not| a link]}, and ",
        "<span>{</span>{This Card|Is not Included}}",
        ", but ",
        {:options => {:inc_name=>"this is",:inc_syntax=>"this is"}},
        ", and some tail"
      ],
    :classes => [String, :EscapedLiteral, String, :Include, String ]
  },

  :links_and_nests => {
    :content => %(Some Links and includes: [[the card|the text]], and {{This Card|Is Included}}{{this too}}
        and [[http://external.wagn.org/path|link text]]{{Included|open}}),
    :rendered =>
      [
        "Some Links and includes: ",
        "<a class=\"wanted-card\" href=\"/the_card?card%5Bname%5D=the+card\">the text</a>",
        ", and ",
        { :options => { :view => "Is Included", :inc_name=>"This Card", :inc_syntax => "This Card|Is Included"}},
        { :options => { :inc_name=>"this too", :inc_syntax=>"this too"}},
        "\n        and ",
        "<a target=\"_blank\" class=\"external-link\" href=\"http://external.wagn.org/path\">link text</a>",
        { :options => { :view=>"open", :inc_name=>"Included", :inc_syntax=>"Included|open" }}
      ],
    :classes => [String, :Link, String, :Include, :Include, String, :Link, :Include ]
  },

  :uris_and_links => {
    :content => %(Some URIs and Links: http://a.url.com/
        More urls: wagn.com/a/path/to.html
        http://localhost:2020/path?cgi=foo&bar=baz  [[http://brain.org/Home|extra]]
        [ http://gerry.wagn.com/a/path ]
        { https://brain.org/more?args }),
    :rendered =>
      [
        "Some URIs and Links: ", '<a target="_blank" class="external-link" href="http://a.url.com/">http://a.url.com/</a>',
        "\n        More urls: ",
        "<a target=\"_blank\" class=\"external-link\" href=\"http://wagn.com/a/path/to.html\">wagn.com/a/path/to.html</a>",
        "\n        ",
        "<a target=\"_blank\" class=\"external-link\" href=\"http://localhost:2020/path?cgi=foo&amp;bar=baz\">http://localhost:2020/path?cgi=foo&bar=baz</a>",
        "  ",
        "<a target=\"_blank\" class=\"external-link\" href=\"http://brain.org/Home\">extra</a>",
        "\n        [ ",
        "<a target=\"_blank\" class=\"external-link\" href=\"http://gerry.wagn.com/a/path\">http://gerry.wagn.com/a/path</a>",
        " ]\n        { ",
        "<a target=\"_blank\" class=\"external-link\" href=\"https://brain.org/more?args\">https://brain.org/more?args</a>",
        " }"
      ],
    :text_rendered =>
      [
         "Some URIs and Links: ", 'http://a.url.com/',
         "\n        More urls: ",
         "wagn.com/a/path/to.html[http://wagn.com/a/path/to.html]",
         "\n        ",
         "http://localhost:2020/path?cgi=foo&bar=baz",
         "  ",
         "extra[http://brain.org/Home]",
         "\n        [ ",
         "http://gerry.wagn.com/a/path",
         " ]\n        { ",
         "https://brain.org/more?args",
         " }"
       ],
    :classes => [String, :URI, String, :HostURI, String, :URI, String, :Link, String, :URI, String, :URI, String ]
  },

  :uris_and_links_2 => {
    :content => %(Some URIs and Links: http://a.url.com
        More urls: wagn.com/a/path/to.html
        [ http://gerry.wagn.com/a/path ]
        { https://brain.org/more?args }
        http://localhost:2020/path?cgi=foo&bar=baz  [[http://brain.org/Home|extra]]),
    :rendered =>
      [
        "Some URIs and Links: ","<a target=\"_blank\" class=\"external-link\" href=\"http://a.url.com\">http://a.url.com</a>",
        "\n        More urls: ",
        "<a target=\"_blank\" class=\"external-link\" href=\"http://wagn.com/a/path/to.html\">wagn.com/a/path/to.html</a>",
        "\n        [ ",
        "<a target=\"_blank\" class=\"external-link\" href=\"http://gerry.wagn.com/a/path\">http://gerry.wagn.com/a/path</a>",
        " ]\n        { ",
        "<a target=\"_blank\" class=\"external-link\" href=\"https://brain.org/more?args\">https://brain.org/more?args</a>",
        " }\n        ",
        "<a target=\"_blank\" class=\"external-link\" href=\"http://localhost:2020/path?cgi=foo&amp;bar=baz\">http://localhost:2020/path?cgi=foo&bar=baz</a>",
        "  ",
        "<a target=\"_blank\" class=\"external-link\" href=\"http://brain.org/Home\">extra</a>"
      ],
    :classes =>  [String, :URI, String, :HostURI, String, :URI, String, :URI, String, :URI, String, :Link ]
  },

  :no_chunks => {
    :content => "No chunks",
    :rendered => "No chunks"
  },

  :single_nest => {
    :content => "{{one inclusion|size;large}}",
    :classes => [:Include]
  },

  :css => {
    :content => %~
     /* body text */
     body {
       color: #444444;
     }

     /* page - background image and color */
     body#wagn {
       background: #ffffff;
     }

     /* top bar background color; text colors */
     #menu {
       background: #3260a0;
     }
     #menu a {
       color: #EEEEEE;
     }

     /* header text */
     h1, h2 {
       color: #664444;
     }
     h1.page-header,
     h2.page-header {
       color: #222299;
     }
   ~
  }
}

Instance Method Summary collapse

Methods included from SetPatternSpecHelper

#it_generates

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



7
8
9
10
11
12
13
14
# File 'mod/03_machines/spec/lib/shared_machine_examples.rb', line 7

def method_missing m, *args, &block
  case m
  when /that_produces_(.+)/
    return $1
  else
    super
  end
end

Instance Method Details

#card_core_dev_simplecov_filtersObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/card/simplecov_helper.rb', line 44

def card_core_dev_simplecov_filters
  filters.clear # This will remove the :root_filter that comes via simplecov's defaults
  add_filter do |src|
    !(src.filename =~ /^#{SimpleCov.root}/) unless src.filename =~ /card/
  end    
  
  add_filter '/spec/'
  add_filter '/features/'
  add_filter '/config/'
  add_filter '/tasks/'
  add_filter '/generators/'
  add_filter 'lib/card'

  add_group 'Card', 'lib/card'  
  add_group 'Set Patterns', 'tmp/set_pattern/'
  add_group 'Sets',         'tmp/set/'
  add_group 'Formats' do |src_file|
    src_file.filename =~ /mod\/[^\/]+\/format/
  end
  add_group 'Chunks' do |src_file|
    src_file.filename =~ /mod\/[^\/]+\/chunk/
  end
end

#card_simplecov_filtersObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/card/simplecov_helper.rb', line 5

def card_simplecov_filters
  add_filter 'spec/'
  add_filter '/config/'
  add_filter '/tasks/'
	
	# filter all card mods
  add_filter do |src_file|
    src_file.filename =~ /tmp\// and not
    /\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/**/#{m[1].gsub("-","/")}"].present? }
  end
	
	# add group for each deck mod
  Dir['mod/*'].map{ |path| path.sub('mod/','') }.each do |mod|
    add_group mod.capitalize do |src_file|
      src_file.filename =~ /mod\/#{mod}\// or 
        (
          src_file.filename =~ /tmp\// and
          /\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/#{mod}/**/#{m[1].gsub("-","/")}"].present? } and
          is_in_mod? src_file,mod
        )
    end
  end

  add_group 'Sets' do |src_file|
    src_file.filename =~ /tmp\/set\// and
    /\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/**/#{m[1]}"].present? }
  end
  add_group 'Set patterns' do |src_file|
    src_file.filename =~ /tmp\/set_pattern\// and
    /\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/**/#{m[1]}"].present? }
  end
  add_group 'Formats' do |src_file|
    src_file.filename =~ /mod\/[^\/]+\/formats/
  end
  add_group 'Chunks' do |src_file|
    src_file.filename =~ /mod\/[^\/]+\/chunks/
  end
end

#is_in_mod?(file, mod_path) ⇒ Boolean

Returns:

  • (Boolean)


1
2
3
4
# File 'lib/card/simplecov_helper.rb', line 1

def is_in_mod? file,mod_path
  mod_msg = "below pulled from #{Rails.root}/mod/#{mod_path}/"
  file.src.join("") =~ /#{mod_msg}/
end

#that_produces(type) ⇒ Object



3
4
5
# File 'mod/03_machines/spec/lib/shared_machine_examples.rb', line 3

def that_produces type
  type
end