Top Level Namespace

Defined Under Namespace

Modules: ActiveRecord, ActiveSupport, Cardio, CarrierWave Classes: Card

Constant Summary collapse

A_JOINEES =
%w(B C D E F).freeze
CARDS_MATCHING_TWO =
["Joe User", "One+Two", "One+Two+Three",
"script: slot+*all+*script+*machine cache", "Two"].freeze
EXAMPLES =
{
  nests: {
    content: "Some Literals: \\[{I'm not| a link]}, and " \
                '\\{{This Card|Is not Included}}' \
                ", but " \
                "{{this is}}" \
                ", and some tail",
    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"
                          }
               },
               " 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>',
               " More urls: ",
               '<a target="_blank" class="external-link" ' \
                 'href="http://wagn.com/a/path/to.html">' \
                 "wagn.com/a/path/to.html</a>",
               " ",
               '<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>',
               " [ ",
               '<a target="_blank" class="external-link" ' \
                 'href="http://gerry.wagn.com/a/path">' \
                 "http://gerry.wagn.com/a/path</a>",
               " ] { ",
               '<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/",
                    " More urls: ",
                    "wagn.com/a/path/to.html[http://wagn.com/a/path/to.html]",
                    " ",
                    "http://localhost:2020/path?cgi=foo&bar=baz",
                    " ",
                    "extra[http://brain.org/Home]",
                    " [ ",
                    "http://gerry.wagn.com/a/path",
                    " ] { ",
                    "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>',
               " More urls: ",
               '<a target="_blank" class="external-link" ' \
                 'href="http://wagn.com/a/path/to.html">' \
                 "wagn.com/a/path/to.html</a>",
               " [ ",
               '<a target="_blank" class="external-link" ' \
                 'href="http://gerry.wagn.com/a/path">' \
                 "http://gerry.wagn.com/a/path</a>",
               " ] { ",
               '<a target="_blank" class="external-link" ' \
                 'href="https://brain.org/more?args">' \
                 "https://brain.org/more?args</a>",
               " } ",
               '<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 nest|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;
     }
   )
  }
}.freeze

Instance Method Summary collapse

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/machines/spec/lib/shared_machine_examples.rb', line 7

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

Instance Method Details

#card_gem_rootObject

Note: I18n::Tasks only knows how to function when run from root of Card GEM, since it locates its configuration file and source to parse relative to this



12
13
14
# File 'spec/lib/card/i18n_spec.rb', line 12

def card_gem_root
  Pathname(__FILE__).parent.parent.parent.parent.to_s
end

#it_generates(opts) ⇒ Object



3
4
5
6
7
8
9
# File 'spec/lib/card/set_pattern_spec.rb', line 3

def it_generates opts
  name = opts[:name]
  card = opts[:from]
  it "generates name '#{name}' for card '#{card.name}'" do
    expect(described_class.new(card).to_s).to eq(name)
  end
end

#that_produces(type) ⇒ Object



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

def that_produces type
  type
end