Module: LoyalCore

Defined in:
lib/loyal_core/acts/uuid_ful.rb,
lib/loyal_core.rb,
lib/loyal_core/acts.rb,
lib/loyal_core/utils.rb,
lib/loyal_core/config.rb,
lib/loyal_core/engine.rb,
lib/loyal_core/memoist.rb,
lib/loyal_core/version.rb,
lib/loyal_core/acts/tree.rb,
app/models/loyal_core/skin.rb,
lib/loyal_core/action_view.rb,
lib/loyal_core/active_model.rb,
lib/loyal_core/action_helper.rb,
lib/loyal_core/acts/bit_able.rb,
lib/loyal_core/acts/has_avatar.rb,
lib/loyal_core/utils/data_util.rb,
lib/loyal_core/utils/text_util.rb,
app/models/loyal_core/skin/dish.rb,
lib/loyal_core/utils/array_util.rb,
app/models/loyal_core/like_track.rb,
lib/loyal_core/utils/config_util.rb,
app/models/loyal_core/skin/folder.rb,
app/models/loyal_core/skin/recipe.rb,
lib/loyal_core/acts/has_permalink.rb,
app/models/loyal_core/rating_track.rb,
lib/loyal_core/acts/skin_dish_able.rb,
app/helpers/loyal_core/jumps_helper.rb,
lib/loyal_core/acts/like_track_able.rb,
lib/loyal_core/acts/views_count_able.rb,
lib/loyal_core/acts/content_mode_able.rb,
lib/loyal_core/acts/named_filter_able.rb,
lib/loyal_core/acts/rating_track_able.rb,
app/uploaders/loyal_core/asset_uploader.rb,
lib/loyal_core/acts/content_depart_able.rb,
app/uploaders/loyal_core/avatar_uploader.rb,
app/helpers/loyal_core/application_helper.rb,
app/controllers/loyal_core/ajax_controller.rb,
app/controllers/loyal_core/jumps_controller.rb,
app/helpers/loyal_core/ajax/captchas_helper.rb,
lib/loyal_core/active_model/strip_whitespace.rb,
lib/loyal_core/active_model/fix_counter_cache.rb,
app/helpers/loyal_core/ajax/like_tracks_helper.rb,
lib/loyal_core/active_model/human_display_able.rb,
app/helpers/loyal_core/admin/skin/folders_helper.rb,
app/helpers/loyal_core/admin/skin/recipes_helper.rb,
app/helpers/loyal_core/ajax/rating_tracks_helper.rb,
app/controllers/loyal_core/application_controller.rb,
app/helpers/loyal_core/ajax/users/sessions_helper.rb,
lib/loyal_core/action_helper/font_selector_helper.rb,
app/controllers/loyal_core/ajax/captchas_controller.rb,
lib/loyal_core/action_helper/ajax/like_tracks_helper.rb,
app/controllers/loyal_core/ajax/like_tracks_controller.rb,
lib/loyal_core/action_helper/ajax/rating_tracks_helper.rb,
app/controllers/loyal_core/admin/skin/folders_controller.rb,
app/controllers/loyal_core/admin/skin/recipes_controller.rb,
app/controllers/loyal_core/ajax/rating_tracks_controller.rb,
app/controllers/loyal_core/ajax/users/sessions_controller.rb

Overview

usage:

include LoyalCore::ActsAsUUIDFul

Defined Under Namespace

Modules: ActionController, ActionHelper, ActionView, ActiveModel, ActsAsBitAble, ActsAsContentDepartAble, ActsAsContentModeAble, ActsAsHasAvatar, ActsAsHasPermalink, ActsAsLikeTrackAble, ActsAsNamedFilterAble, ActsAsRatingTrackAble, ActsAsSkinDishAble, ActsAsTree, ActsAsUUIDFul, ActsAsViewsCountAble, Ajax, ApplicationHelper, FontSelectorHelper, JumpsHelper, Memoist, Skin Classes: AjaxController, ApplicationController, ArrayUtil, AssetUploader, AvatarUploader, Config, ConfigUtil, ConfigUtilItem, DataUtil, Engine, JumpsController, LikeTrack, RatingTrack, TextUtil

Constant Summary collapse

DEFAULT_CLAZZ_ALIAS =
::LoyalCore::DataUtil.new(
  :like_track   => 'LoyalCore::LikeTrack',
  :rating_track => 'LoyalCore::RatingTrack'
)
SANITIZED_CONFIGS =
{
  :relaxed => {        # 宽松的
    :elements => %w[
        a abbr b bdo blockquote br caption cite code col colgroup dd del dfn dl
        dt em figcaption figure h1 h2 h3 h4 h5 h6 hgroup i img ins kbd li mark
        ol p pre q rp rt ruby s samp small strike strong sub sup table tbody td
        tfoot th thead time tr u ul var wbr span code
    ],

    :attributes => {
      :all         => ['dir', 'lang', 'title', 'style', 'name', 'id'],
      'a'          => ['href', 'target', 'name', 'title'],
      'blockquote' => ['cite'],
      'col'        => ['span', 'width'],
      'colgroup'   => ['span', 'width'],
      'del'        => ['cite', 'datetime'],
      'img'        => ['align', 'alt', 'height', 'src', 'width', 'title'],
      'ins'        => ['cite', 'datetime'],
      'ol'         => ['start', 'reversed', 'type'],
      'q'          => ['cite'],
      'table'      => ['summary', 'width', 'border', 'bordercolor'],
      'td'         => ['abbr', 'axis', 'colspan', 'rowspan', 'width'],
      'th'         => ['abbr', 'axis', 'colspan', 'rowspan', 'scope', 'width'],
      'time'       => ['datetime', 'pubdate'],
      'ul'         => ['type'],
      'pre'        => ['class', 'lang'],
      'code'       => ['class']
    },

    :protocols => {
      'a'          => {'href' => ['ftp', 'http', 'https', 'mailto', :relative]},
      'blockquote' => {'cite' => ['http', 'https', :relative]},
      'del'        => {'cite' => ['http', 'https', :relative]},
      'img'        => {'src'  => ['http', 'https', :relative]},
      'ins'        => {'cite' => ['http', 'https', :relative]},
      'q'          => {'cite' => ['http', 'https', :relative]}
    }
  },

  :restricted => {
    :elements => %w[b em i strong u]
  },

  :basic => {
    :elements => %w[
        a abbr b blockquote br cite code dd dfn dl dt em i kbd li mark ol p pre
        q s samp small strike strong sub sup time u ul var
    ],

      :attributes => {
      'a'          => ['href', 'target'],
      'abbr'       => ['title'],
      'blockquote' => ['cite'],
      'dfn'        => ['title'],
      'q'          => ['cite'],
      'time'       => ['datetime', 'pubdate']
    },

    :add_attributes => {
      'a' => {'rel' => 'nofollow'}
    },

    :protocols => {
      'a'          => {'href' => ['ftp', 'http', 'https', 'mailto', :relative]},
      'blockquote' => {'cite' => ['http', 'https', :relative]},
      'q'          => {'cite' => ['http', 'https', :relative]}
    }
  },
  :text => {

  }
}.freeze
VERSION =
"0.0.4"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



84
85
86
# File 'lib/loyal_core/config.rb', line 84

def config
  @config
end

Class Method Details

.configure {|self.config ||= Config.new| ... } ⇒ Object

Yields:



85
86
87
# File 'lib/loyal_core/config.rb', line 85

def configure
  yield self.config ||= Config.new
end