Module: Card::Set

Extended by:
Loader
Includes:
AdvancedApi, Basket, Event, Format, Helpers, Inheritance, Trait
Included in:
Abstract::AceEditor, Abstract::Attachment, Abstract::CodeFile, Abstract::CodePointer, Abstract::Permission, Abstract::Pointer, Abstract::Pointer::Edit, Abstract::ProsemirrorEditor, Abstract::Script, Abstract::SolidCache, All::Account, All::Actify, All::Actions, All::ActiveCard, All::AllCss, All::AllCsv, All::AllJs, All::Base, All::Bootstrap::Form, All::Bootstrap::Helper, All::Bootstrap::Table, All::Bootstrap::Tabs, All::Bootstrap::Wrapper, All::Collection, All::Comment, All::Content, All::ContentHistory, All::EmailHtml, All::EmailText, All::Erb, All::Error, All::Event, All::EventViz, All::Export, All::Fetch, All::File, All::Follow, All::Haml, All::History, All::Initialize, All::Json, All::Links, All::ListChanges, All::LocationHistory, All::Name, All::NameValidations, All::Notify, All::Observer, All::Pattern, All::Permissions, All::Phases, All::References, All::ResetMachines, All::RichBootstrap, All::RichHtml::Content, All::RichHtml::Editing, All::RichHtml::Form, All::RichHtml::Header, All::RichHtml::Menu, All::RichHtml::Modal, All::RichHtml::Toolbar, All::RichHtml::Wrapper, All::Rss, All::Rules, All::SolidCache, All::Stages, All::States, All::Subcards, All::Templating, All::Text, All::TrackedAttributes, All::Trash, All::Type, All::Utils, All::ViewCache, All::ViewViz, Right::Account, Right::AddHelp, Right::Bcc, Right::Cc, Right::Comment, Right::Create, Right::Debug, Right::Default, Right::Delete, Right::Discussion, Right::Email, Right::Follow, Right::FollowFields, Right::Followers, Right::Following, Right::From, Right::Help, Right::HtmlMessage, Right::MachineCache, Right::MachineInput, Right::MachineOutput, Right::Password, Right::Read, Right::Salt, Right::Script, Right::SolidCache, Right::Status, Right::Structure, Right::Style, Right::To, Right::Token, Right::Update, Right::WhenCreated, Right::WhenLastEdited, Rstar::Rules, Rstar::RulesEditor, Self::AccountLinks, Self::Accountable, Self::AddHelp, Self::Admin, Self::AdminInfo, Self::Alerts, Self::Always, Self::Autoname, Self::BootstrapCards, Self::BootstrapJs, Self::BootswatchShared, Self::Captcha, Self::Codenames, Self::Create, Self::Created, Self::Default, Self::DefaultHtmlView, Self::Delete, Self::Edited, Self::Follow, Self::FollowDefaults, Self::FollowFields, Self::Foot, Self::Head, Self::Head::Javascript, Self::Help, Self::Input, Self::Layout, Self::Navbox, Self::Never, Self::Now, Self::OnCreate, Self::OnDelete, Self::OnUpdate, Self::Options, Self::OptionsLabel, Self::Read, Self::Recent, Self::RecentSettings, Self::Script, Self::ScriptAce, Self::ScriptAceConfig, Self::ScriptCardMenu, Self::ScriptEditors, Self::ScriptHtml5shivPrintshiv, Self::ScriptJquery, Self::ScriptJqueryHelper, Self::ScriptMods, Self::ScriptPointerConfig, Self::ScriptProsemirror, Self::ScriptProsemirrorConfig, Self::ScriptSlot, Self::Search, Self::Signin, Self::SmartmenuCss, Self::SmartmenuJs, Self::Structure, Self::Style, Self::StyleBootstrapCompatible, Self::StyleCards, Self::StyleJqueryUiSmoothness, Self::TableOfContents, Self::Thanks, Self::Update, Self::Version, Type::Basic, Type::Cardtype, Type::CoffeeScript, Type::Css, Type::Date, Type::EmailTemplate, Type::File, Type::Html, Type::Image, Type::JavaScript, Type::LayoutType, Type::List, Type::ListedBy, Type::Number, Type::Phrase, Type::PlainText, Type::Pointer, Type::Scss, Type::SearchType, Type::Session, Type::Set, Type::Setting, Type::Signup, Type::Skin, Type::Toggle, Type::Uri, Type::User, TypePlusRight::User::Follow
Defined in:
lib/card/set.rb,
lib/card/set/event.rb,
lib/card/set/trait.rb,
lib/card/set/basket.rb,
lib/card/set/format.rb,
lib/card/set/loader.rb,
lib/card/set/helpers.rb,
lib/card/set_pattern.rb,
lib/card/set/inheritance.rb,
lib/card/set/advanced_api.rb,
tmpsets/set/mod001-core/all/erb.rb,
tmpsets/set/mod001-core/all/haml.rb,
tmpsets/set/mod001-core/all/name.rb,
tmpsets/set/mod001-core/all/type.rb,
tmpsets/set/mod001-core/all/event.rb,
tmpsets/set/mod001-core/all/fetch.rb,
tmpsets/set/mod001-core/all/rules.rb,
tmpsets/set/mod001-core/all/trash.rb,
tmpsets/set/mod001-core/all/utils.rb,
tmpsets/set/mod012-email/right/cc.rb,
tmpsets/set/mod012-email/right/to.rb,
tmpsets/set/mod001-core/all/actify.rb,
tmpsets/set/mod001-core/all/export.rb,
tmpsets/set/mod001-core/all/phases.rb,
tmpsets/set/mod001-core/all/stages.rb,
tmpsets/set/mod001-core/all/states.rb,
tmpsets/set/mod012-email/right/bcc.rb,
tmpsets/set/mod001-core/all/content.rb,
tmpsets/set/mod001-core/all/pattern.rb,
tmpsets/set/mod012-email/all/follow.rb,
tmpsets/set/mod012-email/all/notify.rb,
tmpsets/set/mod012-email/right/from.rb,
tmpsets/set/mod012-email/self/never.rb,
tmpsets/set/mod014-admin/self/admin.rb,
tmpsets/set/mod001-core/all/subcards.rb,
tmpsets/set/mod010-machines/type/css.rb,
tmpsets/set/mod012-email/self/always.rb,
tmpsets/set/mod012-email/self/edited.rb,
tmpsets/set/mod012-email/self/follow.rb,
tmpsets/set/mod016-standard/self/now.rb,
tmpsets/set/mod016-standard/type/set.rb,
tmpsets/set/mod016-standard/type/uri.rb,
tmpsets/set/mod017-account/type/user.rb,
tmpsets/set/mod010-machines/type/scss.rb,
tmpsets/set/mod010-machines/type/skin.rb,
tmpsets/set/mod011-settings/self/help.rb,
tmpsets/set/mod011-settings/self/read.rb,
tmpsets/set/mod012-email/all/observer.rb,
tmpsets/set/mod012-email/right/follow.rb,
tmpsets/set/mod012-email/self/created.rb,
tmpsets/set/mod014-admin/self/version.rb,
tmpsets/set/mod016-standard/all/error.rb,
tmpsets/set/mod016-standard/all/links.rb,
tmpsets/set/mod016-standard/self/foot.rb,
tmpsets/set/mod016-standard/type/date.rb,
tmpsets/set/mod016-standard/type/list.rb,
tmpsets/set/mod017-account/right/salt.rb,
tmpsets/set/mod001-core/all/collection.rb,
tmpsets/set/mod001-core/all/initialize.rb,
tmpsets/set/mod001-core/all/references.rb,
tmpsets/set/mod001-core/all/templating.rb,
tmpsets/set/mod001-core/all/view_cache.rb,
tmpsets/set/mod002-history/all/actions.rb,
tmpsets/set/mod002-history/all/history.rb,
tmpsets/set/mod011-settings/right/help.rb,
tmpsets/set/mod011-settings/right/read.rb,
tmpsets/set/mod011-settings/self/input.rb,
tmpsets/set/mod011-settings/self/style.rb,
tmpsets/set/mod016-standard/type/basic.rb,
tmpsets/set/mod017-account/all/account.rb,
tmpsets/set/mod017-account/right/email.rb,
tmpsets/set/mod017-account/right/token.rb,
tmpsets/set/mod017-account/self/signin.rb,
tmpsets/set/mod017-account/type/signup.rb,
tmpsets/set/mod001-core/all/active_card.rb,
tmpsets/set/mod001-core/all/permissions.rb,
tmpsets/set/mod004-pointer/type/pointer.rb,
tmpsets/set/mod011-settings/right/style.rb,
tmpsets/set/mod011-settings/self/create.rb,
tmpsets/set/mod011-settings/self/delete.rb,
tmpsets/set/mod011-settings/self/layout.rb,
tmpsets/set/mod011-settings/self/script.rb,
tmpsets/set/mod011-settings/self/thanks.rb,
tmpsets/set/mod011-settings/self/update.rb,
tmpsets/set/mod012-email/all/email_html.rb,
tmpsets/set/mod012-email/all/email_text.rb,
tmpsets/set/mod016-standard/all/comment.rb,
tmpsets/set/mod016-standard/rstar/rules.rb,
tmpsets/set/mod016-standard/self/alerts.rb,
tmpsets/set/mod016-standard/self/navbox.rb,
tmpsets/set/mod016-standard/self/recent.rb,
tmpsets/set/mod016-standard/self/search.rb,
tmpsets/set/mod016-standard/type/number.rb,
tmpsets/set/mod016-standard/type/phrase.rb,
tmpsets/set/mod016-standard/type/toggle.rb,
tmpsets/set/mod017-account/right/status.rb,
tmpsets/set/mod003-basic_formats/all/rss.rb,
tmpsets/set/mod009-basic_types/type/html.rb,
tmpsets/set/mod011-settings/right/create.rb,
tmpsets/set/mod011-settings/right/delete.rb,
tmpsets/set/mod011-settings/right/script.rb,
tmpsets/set/mod011-settings/right/update.rb,
tmpsets/set/mod011-settings/self/captcha.rb,
tmpsets/set/mod011-settings/self/default.rb,
tmpsets/set/mod011-settings/self/options.rb,
tmpsets/set/mod011-settings/type/setting.rb,
tmpsets/set/mod012-email/right/followers.rb,
tmpsets/set/mod012-email/right/following.rb,
tmpsets/set/mod013-carrierwave/type/file.rb,
tmpsets/set/mod014-admin/self/admin_info.rb,
tmpsets/set/mod015-developer/right/debug.rb,
tmpsets/set/mod016-standard/type/session.rb,
tmpsets/set/mod017-account/right/account.rb,
tmpsets/set/mod003-basic_formats/all/base.rb,
tmpsets/set/mod003-basic_formats/all/file.rb,
tmpsets/set/mod003-basic_formats/all/json.rb,
tmpsets/set/mod003-basic_formats/all/text.rb,
tmpsets/set/mod011-settings/right/comment.rb,
tmpsets/set/mod011-settings/right/default.rb,
tmpsets/set/mod011-settings/self/add_help.rb,
tmpsets/set/mod011-settings/self/autoname.rb,
tmpsets/set/mod013-carrierwave/type/image.rb,
tmpsets/set/mod015-developer/all/view_viz.rb,
tmpsets/set/mod016-standard/type/cardtype.rb,
tmpsets/set/mod017-account/right/password.rb,
tmpsets/set/mod001-core/abstract/code_file.rb,
tmpsets/set/mod003-basic_formats/self/head.rb,
tmpsets/set/mod011-settings/right/add_help.rb,
tmpsets/set/mod011-settings/self/on_create.rb,
tmpsets/set/mod011-settings/self/on_delete.rb,
tmpsets/set/mod011-settings/self/on_update.rb,
tmpsets/set/mod011-settings/self/structure.rb,
tmpsets/set/mod015-developer/all/event_viz.rb,
tmpsets/set/mod016-standard/self/codenames.rb,
tmpsets/set/mod016-standard/type/listed_by.rb,
tmpsets/set/mod003-basic_formats/all/all_js.rb,
tmpsets/set/mod004-pointer/self/script_mods.rb,
tmpsets/set/mod010-machines/abstract/script.rb,
tmpsets/set/mod011-settings/right/structure.rb,
tmpsets/set/mod012-email/right/html_message.rb,
tmpsets/set/mod001-core/all/location_history.rb,
tmpsets/set/mod001-core/all/name_validations.rb,
tmpsets/set/mod003-basic_formats/all/all_css.rb,
tmpsets/set/mod003-basic_formats/all/all_csv.rb,
tmpsets/set/mod010-machines/self/script_slot.rb,
tmpsets/set/mod010-machines/self/style_cards.rb,
tmpsets/set/mod010-machines/type/java_script.rb,
tmpsets/set/mod011-settings/self/accountable.rb,
tmpsets/set/mod012-email/right/follow_fields.rb,
tmpsets/set/mod012-email/type/email_template.rb,
tmpsets/set/mod016-standard/all/list_changes.rb,
tmpsets/set/mod016-standard/right/discussion.rb,
tmpsets/set/mod016-standard/type/layout_type.rb,
tmpsets/set/mod016-standard/type/search_type.rb,
tmpsets/set/mod005-ace_editor/self/script_ace.rb,
tmpsets/set/mod012-email/self/follow_defaults.rb,
tmpsets/set/mod017-account/self/account_links.rb,
tmpsets/set/mod018-bootstrap/self/script_mods.rb,
tmpsets/set/mod001-core/all/tracked_attributes.rb,
tmpsets/set/mod002-history/all/content_history.rb,
tmpsets/set/mod004-pointer/abstract/01_pointer.rb,
tmpsets/set/mod004-pointer/self/script_editors.rb,
tmpsets/set/mod008-solid_cache/all/solid_cache.rb,
tmpsets/set/mod009-basic_types/type/plain_text.rb,
tmpsets/set/mod010-machines/all/reset_machines.rb,
tmpsets/set/mod010-machines/self/script_jquery.rb,
tmpsets/set/mod010-machines/type/coffee_script.rb,
tmpsets/set/mod011-settings/self/follow_fields.rb,
tmpsets/set/mod011-settings/self/options_label.rb,
tmpsets/set/mod016-standard/all/rich_html/form.rb,
tmpsets/set/mod016-standard/all/rich_html/menu.rb,
tmpsets/set/mod016-standard/right/when_created.rb,
tmpsets/set/mod016-standard/rstar/rules_editor.rb,
tmpsets/set/mod018-bootstrap/self/bootstrap_js.rb,
tmpsets/set/mod018-bootstrap/self/smartmenu_js.rb,
tmpsets/set/mod010-machines/right/machine_cache.rb,
tmpsets/set/mod010-machines/right/machine_input.rb,
tmpsets/set/mod011-settings/abstract/permission.rb,
tmpsets/set/mod016-standard/all/rich_html/modal.rb,
tmpsets/set/mod018-bootstrap/all/bootstrap/form.rb,
tmpsets/set/mod018-bootstrap/all/bootstrap/tabs.rb,
tmpsets/set/mod018-bootstrap/all/rich_bootstrap.rb,
tmpsets/set/mod018-bootstrap/self/smartmenu_css.rb,
tmpsets/set/mod004-pointer/abstract/code_pointer.rb,
tmpsets/set/mod008-solid_cache/right/solid_cache.rb,
tmpsets/set/mod010-machines/right/machine_output.rb,
tmpsets/set/mod011-settings/self/recent_settings.rb,
tmpsets/set/mod016-standard/all/rich_html/header.rb,
tmpsets/set/mod018-bootstrap/all/bootstrap/table.rb,
tmpsets/set/mod005-ace_editor/abstract/ace_editor.rb,
tmpsets/set/mod010-machines/self/script_card_menu.rb,
tmpsets/set/mod016-standard/all/rich_html/content.rb,
tmpsets/set/mod016-standard/all/rich_html/editing.rb,
tmpsets/set/mod016-standard/all/rich_html/toolbar.rb,
tmpsets/set/mod016-standard/all/rich_html/wrapper.rb,
tmpsets/set/mod018-bootstrap/all/bootstrap/helper.rb,
tmpsets/set/mod018-bootstrap/self/bootstrap_cards.rb,
tmpsets/set/mod011-settings/self/default_html_view.rb,
tmpsets/set/mod011-settings/self/table_of_contents.rb,
tmpsets/set/mod013-carrierwave/abstract/attachment.rb,
tmpsets/set/mod016-standard/right/when_last_edited.rb,
tmpsets/set/mod018-bootstrap/all/bootstrap/wrapper.rb,
tmpsets/set/mod004-pointer/abstract/01_pointer/edit.rb,
tmpsets/set/mod008-solid_cache/abstract/solid_cache.rb,
tmpsets/set/mod018-bootstrap/self/bootswatch_shared.rb,
tmpsets/set/mod005-ace_editor/self/script_ace_config.rb,
tmpsets/set/mod012-email/type_plus_right/user/follow.rb,
tmpsets/set/mod004-pointer/self/script_pointer_config.rb,
tmpsets/set/mod010-machines/self/script_jquery_helper.rb,
tmpsets/set/mod003-basic_formats/self/01_head/javascript.rb,
tmpsets/set/mod010-machines/self/script_html5shiv_printshiv.rb,
tmpsets/set/mod010-machines/self/style_bootstrap_compatible.rb,
tmpsets/set/mod010-machines/self/style_jquery_ui_smoothness.rb,
tmpsets/set/mod006-prosemirror_editor/self/script_prosemirror.rb,
tmpsets/set/mod006-prosemirror_editor/abstract/prosemirror_editor.rb,
tmpsets/set/mod006-prosemirror_editor/self/script_prosemirror_config.rb

Overview

A 'Set' is a group of Cards to which 'Rules' may be applied. Sets can be as specific as a single card, as general as all cards, or anywhere in between.

Rules take two main forms: card rules and code rules.

'Card rules' are defined in card content. These are generally configured via the web interface and are thus documented at http://wagn.org/rules.

'Code rules' can be defined in a 'set module'. Card::Set supports creating and organizing these set modules. It also provides an API for defining special methods within set modules.

Set modules follow the following naming convention:

 MOD/set/PATTERN/ANCHOR[/FREENAME].rb

For example, suppose you created a "mod" (a Card modification) for managing your contacts called "contactmanager", and you wanted to write code that would apply to all +address cards. You could add a file here:

 ./contactmanager/set/right/address.rb

or here:

 ./contactmanager/set/right/address/countries.rb

Then, whenever you fetch or instantiate a +address card, the card will automatically include code from that set module. In fact, it will include all the set modules associated with sets of which it is a member.

For example, say you have a Plaintext card named 'Philipp+address', and you have set files for the following sets:

 * all cards
 * all Plaintext cards
 * all cards ending in +address

When you run this:

 mycard = Card.fetch 'Philipp+address'

...then mycard will include the set modules associated with each of those sets in the above order.

You can quickly create a new set module running

 `wagn generate set MOD PATTERN ANCHOR`

In the current example, this would translate to:

 `wagn generate set contactmanager right address`.

Note that the set module's filename connects it to the set, so both the set_pattern and the set_anchor must correspond to the codename of a card in the database to function correctly.

A set module is "just ruby", but is generally quite concise because Card (a) uses its the set module's file location to autogenerate ruby module names and (b) then uses Card::Set module to provide API for the most common set methods.

Defined Under Namespace

Modules: AdvancedApi, Basket, Event, Format, Helpers, Inheritance, Loader, Trait Classes: Abstract, All, AllPlus, Pattern, Right, Rstar, Self, Star, Type, TypePlusRight

Method Summary

Methods included from Loader

clean_empty_module_from_hash, clean_empty_modules, extended, pattern_and_modules_from_path, process_base_modules, register_set, tmp_file_template, write_tmp_file

Methods included from Helpers

#abstract_set?, #all_set?, #shortname

Methods included from AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#all_set_format_mod!, #define_on_format, #format, #register_set_format, #view

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer

Methods included from Event

#event