This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Liquid::Tags | |
class PageBanners < ::Liquid::Tag | |
Syntax = /(#{::Liquid::Expression}+)\s+max\s+([0-9]+)/ | |
def initialize(tag_name, markup, tokens, context) | |
if markup =~ Syntax | |
@collection_name = $1 | |
@max_number = $2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>{{ artist.name }}</h2> | |
<div>{{ artist.bio }}</div> | |
{% with_scope artist: artist._id %} | |
{% assign comments = contents.comments %} | |
{% if comments == empty %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support/dependencies' | |
module ActiveSupport::Dependencies | |
alias_method :require_or_load_without_multiple, :require_or_load | |
def require_or_load(file_name, const_path = nil) | |
if file_name.starts_with?(Rails.root.to_s + '/app') | |
relative_name = file_name.gsub(/^#{Rails.root.to_s}/, '') | |
@engine_paths ||= Rails::Application.railties.engines.collect{|engine| engine.config.root.to_s } | |
@engine_paths.each do |path| | |
engine_file = File.join(path, relative_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyApp | |
class IncViewsCounterFor < ::Liquid::Tag | |
Syntax = /(#{::Liquid::Expression}+)?/ | |
def initialize(tag_name, markup, tokens, context) | |
if markup =~ Syntax | |
@name = $1 | |
else | |
raise ::Liquid::SyntaxError.new("Syntax Error in 'inc_views_counter_for' - Valid syntax: inc_views_counter_for <content>") |