source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/standard_filter_test.rb
Ruby
mit
11,774
main
47,235
# encoding: utf-8 # frozen_string_literal: true require 'test_helper' class TestThing attr_reader :foo def initialize @foo = 0 end def to_s "woot: #{@foo}" end def [](_whatever) to_s end def to_liquid @foo += 1 self end end class TestDrop < Liquid::Drop def initialize(valu...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/hash_rendering_test.rb
Ruby
mit
11,774
main
4,809
# frozen_string_literal: true require 'test_helper' class HashRenderingTest < Minitest::Test def test_render_empty_hash assert_template_result("{}", "{{ my_hash }}", { "my_hash" => {} }) end def test_render_hash_with_string_keys_and_values assert_template_result("{\"key1\"=>\"value1\", \"key2\"=>\"valu...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/context_test.rb
Ruby
mit
11,774
main
20,908
# frozen_string_literal: true require 'test_helper' class HundredCentes def to_liquid 100 end end class CentsDrop < Liquid::Drop def amount HundredCentes.new end def non_zero? true end end class ContextSensitiveDrop < Liquid::Drop def test @context['test'] end end class Category ...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/profiler_test.rb
Ruby
mit
11,774
main
6,962
# frozen_string_literal: true require 'test_helper' class ProfilerTest < Minitest::Test class TestDrop < Liquid::Drop def initialize(value) super() @value = value end def to_s artificial_execution_time @value end private # Monotonic clock precision fluctuate based...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/capture_test.rb
Ruby
mit
11,774
main
2,895
# frozen_string_literal: true require 'test_helper' class CaptureTest < Minitest::Test include Liquid def test_captures_block_content_in_variable assert_template_result("test string", "{% capture var %}test string{% endcapture %}{{var}}", {}) end def test_captures_block_content_in_quoted_variable_in_lax...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/variable_test.rb
Ruby
mit
11,774
main
9,550
# frozen_string_literal: true require 'test_helper' require 'timeout' class VariableTest < Minitest::Test include Liquid def test_simple_variable assert_template_result('worked', "{{test}}", { 'test' => 'worked' }) assert_template_result('worked wonderfully', "{{test}}", { 'test' => 'worked wonderfully' ...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/blank_test.rb
Ruby
mit
11,774
main
3,416
# frozen_string_literal: true require 'test_helper' class FoobarTag < Liquid::Tag def render_to_output_buffer(_context, output) output << ' ' output end end class BlankTest < Minitest::Test include Liquid N = 10 def wrap_in_for(body) "{% for i in (1..#{N}) %}#{body}{% endfor %}" end def w...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/filter_kwarg_test.rb
Ruby
mit
11,774
main
544
# frozen_string_literal: true require 'test_helper' class FilterKwargTest < Minitest::Test module KwargFilter def html_tag(_tag, attributes) attributes .map { |key, value| "#{key}='#{value}'" } .join(' ') end end include Liquid def test_can_parse_data_kwargs with_global_fil...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/drop_test.rb
Ruby
mit
11,774
main
10,112
# frozen_string_literal: true require 'test_helper' class ContextDrop < Liquid::Drop def scopes @context.scopes.size end def scopes_as_array (1..@context.scopes.size).to_a end def loop_pos @context['forloop.index'] end def liquid_method_missing(method) @context[method] end end clas...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/template_test.rb
Ruby
mit
11,774
main
15,333
# frozen_string_literal: true require 'test_helper' require 'timeout' class TemplateContextDrop < Liquid::Drop def liquid_method_missing(method) method end def foo 'fizzbuzz' end def baz @context.registers['lulz'] end end class SomethingWithLength < Liquid::Drop def length nil end e...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/output_test.rb
Ruby
mit
11,774
main
3,307
# frozen_string_literal: true require 'test_helper' module FunnyFilter def make_funny(_input) 'LOL' end def cite_funny(input) "LOL: #{input}" end def add_smiley(input, smiley = ":-)") "#{input} #{smiley}" end def add_tag(input, tag = "p", id = "foo") %(<#{tag} id="#{id}">#{input}</#{t...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/security_test.rb
Ruby
mit
11,774
main
2,987
# frozen_string_literal: true require 'test_helper' module SecurityFilter def add_one(input) "#{input} + 1" end end class SecurityTest < Minitest::Test include Liquid def setup @assigns = {} end def test_no_instance_eval text = %( {{ '1+1' | instance_eval }} ) expected = %( 1+1 ) ...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tag/disableable_test.rb
Ruby
mit
11,774
main
1,422
# frozen_string_literal: true require 'test_helper' class TagDisableableTest < Minitest::Test include Liquid module RenderTagName def render(_context) tag_name end end class Custom < Tag prepend Liquid::Tag::Disableable include RenderTagName end class Custom2 < Tag prepend Liq...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/table_row_test.rb
Ruby
mit
11,774
main
14,541
# frozen_string_literal: true require 'test_helper' class TableRowTest < Minitest::Test include Liquid class ArrayDrop < Liquid::Drop include Enumerable def initialize(array) @array = array end def each(&block) @array.each(&block) end end def test_table_row assert_templ...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/inline_comment_test.rb
Ruby
mit
11,774
main
2,110
# frozen_string_literal: true require 'test_helper' class InlineCommentTest < Minitest::Test include Liquid def test_inline_comment_returns_nothing assert_template_result('', '{%- # this is an inline comment -%}') assert_template_result('', '{%-# this is an inline comment -%}') assert_template_result...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/render_tag_test.rb
Ruby
mit
11,774
main
10,733
# frozen_string_literal: true require 'test_helper' class RenderTagTest < Minitest::Test include Liquid def test_render_with_no_arguments assert_template_result( 'rendered content', '{% render "source" %}', partials: { 'source' => 'rendered content' }, ) end def test_render_tag_loo...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/liquid_tag_test.rb
Ruby
mit
11,774
main
3,731
# frozen_string_literal: true require 'test_helper' class LiquidTagTest < Minitest::Test include Liquid def test_liquid_tag assert_template_result('1 2 3', <<~LIQUID, { 'array' => [1, 2, 3] }) {%- liquid echo array | join: " " -%} LIQUID assert_template_result('1 2 3', <<~LIQUID,...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/standard_tag_test.rb
Ruby
mit
11,774
main
13,558
# frozen_string_literal: true require 'test_helper' class StandardTagTest < Minitest::Test include Liquid def test_no_transform assert_template_result( 'this text should come out of the template without change...', 'this text should come out of the template without change...', ) assert_t...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/raw_tag_test.rb
Ruby
mit
11,774
main
1,843
# frozen_string_literal: true require 'test_helper' class RawTagTest < Minitest::Test include Liquid def test_tag_in_raw assert_template_result( '{% comment %} test {% endcomment %}', '{% raw %}{% comment %} test {% endcomment %}{% endraw %}', ) end def test_output_in_raw assert_temp...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/if_else_tag_test.rb
Ruby
mit
11,774
main
9,528
# frozen_string_literal: true require 'test_helper' class IfElseTagTest < Minitest::Test include Liquid def test_if assert_template_result(' ', ' {% if false %} this text should not go into the output {% endif %} ') assert_template_result( ' this text should go into the output ', ' {% if t...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/break_tag_test.rb
Ruby
mit
11,774
main
380
# frozen_string_literal: true require 'test_helper' class BreakTagTest < Minitest::Test include Liquid # tests that no weird errors are raised if break is called outside of a # block def test_break_with_no_block assigns = { 'i' => 1 } markup = 'before{% break %}after' expected = 'before' ...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/increment_tag_test.rb
Ruby
mit
11,774
main
2,455
# frozen_string_literal: true require 'test_helper' class IncrementTagTest < Minitest::Test include Liquid def test_inc assert_template_result('0 1', '{%increment port %} {{ port }}') assert_template_result(' 0 1 2', '{{port}} {%increment port %} {%increment port%} {{port}}') assert_template_result( ...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/continue_tag_test.rb
Ruby
mit
11,774
main
365
# frozen_string_literal: true require 'test_helper' class ContinueTagTest < Minitest::Test include Liquid # tests that no weird errors are raised if continue is called outside of a # block def test_continue_with_no_block assigns = {} markup = '{% continue %}' expected = '' assert_template...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/statements_test.rb
Ruby
mit
11,774
main
3,702
# frozen_string_literal: true require 'test_helper' class StatementsTest < Minitest::Test include Liquid def test_true_eql_true text = ' {% if true == true %} true {% else %} false {% endif %} ' assert_template_result(' true ', text) end def test_true_not_eql_true text = ' {% if true != true %...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/echo_test.rb
Ruby
mit
11,774
main
276
# frozen_string_literal: true require 'test_helper' class EchoTest < Minitest::Test include Liquid def test_echo_outputs_its_input assert_template_result('BAR', <<~LIQUID, { 'variable-name' => 'bar' }) {%- echo variable-name | upcase -%} LIQUID end end
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/unless_else_tag_test.rb
Ruby
mit
11,774
main
1,279
# frozen_string_literal: true require 'test_helper' class UnlessElseTagTest < Minitest::Test include Liquid def test_unless assert_template_result(' ', ' {% unless true %} this text should not go into the output {% endunless %} ') assert_template_result( ' this text should go into the output ', ...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/cycle_tag_test.rb
Ruby
mit
11,774
main
5,350
# frozen_string_literal: true require 'test_helper' class CycleTagTest < Minitest::Test def test_simple_cycle_inside_for_loop template = <<~LIQUID {%- for i in (1..3) -%} {%- cycle '1', '2', '3' -%} {%- endfor -%} LIQUID assert_template_result("123", template) end def test_cycl...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/for_tag_test.rb
Ruby
mit
11,774
main
15,967
# frozen_string_literal: true require 'test_helper' class ThingWithValue < Liquid::Drop def value 3 end end class ForTagTest < Minitest::Test include Liquid def test_for assert_template_result(' yo yo yo yo ', '{%for item in array%} yo {%endfor%}', { 'array' => [1, 2, 3, 4] }) assert_template...
github
Shopify/liquid
https://github.com/Shopify/liquid
test/integration/tags/include_tag_test.rb
Ruby
mit
11,774
main
15,946
# frozen_string_literal: true require 'test_helper' class TestFileSystem PARTIALS = { "nested_template" => "{% include 'header' %} {% include 'body' %} {% include 'footer' %}", "body" => "body {% include 'body_detail' %}", } def read_template_file(template_path) PARTIALS[template_path] || template_...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid.rb
Ruby
mit
11,774
main
3,472
# frozen_string_literal: true # Copyright (c) 2005 Tobias Luetke # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/registers.rb
Ruby
mit
11,774
main
965
# frozen_string_literal: true module Liquid class Registers attr_reader :static def initialize(registers = {}) @static = registers.is_a?(Registers) ? registers.static : registers @changes = {} end def []=(key, value) @changes[key] = value end def [](key) if @changes...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/lexer.rb
Ruby
mit
11,774
main
5,702
# frozen_string_literal: true module Liquid class Lexer CLOSE_ROUND = [:close_round, ")"].freeze CLOSE_SQUARE = [:close_square, "]"].freeze COLON = [:colon, ":"].freeze COMMA = [:comma, ","].freeze COMPARISION_NOT_EQUAL = [:comparison, "!="].freeze COMPARISON_CONTAINS = [:comparison, "contain...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tablerowloop_drop.rb
Ruby
mit
11,774
main
2,763
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type object # @liquid_name tablerowloop # @liquid_summary # Information about a parent [`tablerow` loop](/docs/api/liquid/tags/tablerow). class TablerowloopDrop < Drop def initialize(length, cols) @length = length ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tokenizer.rb
Ruby
mit
11,774
main
3,296
# frozen_string_literal: true require "strscan" module Liquid class Tokenizer attr_reader :line_number, :for_liquid_tag TAG_END = /%\}/ TAG_OR_VARIABLE_START = /\{[\{\%]/ NEWLINE = /\n/ OPEN_CURLEY = "{".ord CLOSE_CURLEY = "}".ord PERCENTAGE = "%".ord def initialize( source:...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/context.rb
Ruby
mit
11,774
main
10,084
# frozen_string_literal: true module Liquid # Context keeps the variable stack and resolves variables, as well as keywords # # context['variable'] = 'testing' # context['variable'] #=> 'testing' # context['true'] #=> true # context['10.2232'] #=> 10.2232 # # context.stack do # con...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/extensions.rb
Ruby
mit
11,774
main
780
# frozen_string_literal: true require 'time' require 'date' class String # :nodoc: def to_liquid self end end class Symbol # :nodoc: def to_liquid to_s end end class Array # :nodoc: def to_liquid self end end class Hash # :nodoc: def to_liquid self end end class Numeric # :nodoc: ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tag.rb
Ruby
mit
11,774
main
1,717
# frozen_string_literal: true require 'liquid/tag/disabler' require 'liquid/tag/disableable' module Liquid class Tag attr_reader :nodelist, :tag_name, :line_number, :parse_context alias_method :options, :parse_context include ParserSwitching class << self def parse(tag_name, markup, tokenizer...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/interrupts.rb
Ruby
mit
11,774
main
479
# frozen_string_literal: true module Liquid # An interrupt is any command that breaks processing of a block (ex: a for loop). class Interrupt attr_reader :message def initialize(message = nil) @message = message || "interrupt" end end # Interrupt that is thrown whenever a {% break %} is cal...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/parse_context.rb
Ruby
mit
11,774
main
2,891
# frozen_string_literal: true module Liquid class ParseContext attr_accessor :locale, :line_number, :trim_whitespace, :depth attr_reader :partial, :warnings, :error_mode, :environment def initialize(options = Const::EMPTY_HASH) @environment = options.fetch(:environment, Environment.default) ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/parser_switching.rb
Ruby
mit
11,774
main
2,155
# frozen_string_literal: true module Liquid module ParserSwitching # Do not use this. # # It's basically doing the same thing the {#parse_with_selected_parser}, # except this will try the strict parser regardless of the error mode, # and fall back to the lax parser if the error mode is lax or war...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/parser.rb
Ruby
mit
11,774
main
2,530
# frozen_string_literal: true module Liquid class Parser def initialize(input, reject_bare_brackets: false) ss = input.is_a?(StringScanner) ? input : StringScanner.new(input) @tokens = Lexer.tokenize(ss) @p = 0 # pointer to current location @reject_bare_brackets = reject_bare_bracket...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/strainer_template.rb
Ruby
mit
11,774
main
1,767
# frozen_string_literal: true require 'set' module Liquid # StrainerTemplate is the computed class for the filters system. # New filters are mixed into the strainer class which is then instantiated for each liquid template render run. # # The Strainer only allows method calls defined in filters given to it vi...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/block.rb
Ruby
mit
11,774
main
2,332
# frozen_string_literal: true module Liquid class Block < Tag MAX_DEPTH = 100 def initialize(tag_name, markup, options) super @blank = true end def parse(tokens) @body = new_body while parse_body(@body, tokens) end @body.freeze end # For backwards compat...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/variable.rb
Ruby
mit
11,774
main
6,103
# frozen_string_literal: true module Liquid # Holds variables. Variables are only loaded "just in time" # and are not evaluated as part of the render stage # # {{ monkey }} # {{ user.name }} # # Variables can be combined with filters: # # {{ user | link }} # class Variable FilterMarkupR...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/variable_lookup.rb
Ruby
mit
11,774
main
3,406
# frozen_string_literal: true module Liquid class VariableLookup COMMAND_METHODS = ['size', 'first', 'last'].freeze attr_reader :name, :lookups def self.parse(markup, string_scanner = StringScanner.new(""), cache = nil) new(markup, string_scanner, cache) end def initialize(markup, string...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/utils.rb
Ruby
mit
11,774
main
4,321
# frozen_string_literal: true module Liquid module Utils DECIMAL_REGEX = /\A-?\d+\.\d+\z/ UNIX_TIMESTAMP_REGEX = /\A\d+\z/ def self.slice_collection(collection, from, to) if (from != 0 || !to.nil?) && collection.respond_to?(:load_slice) collection.load_slice(from, to) else sl...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/deprecations.rb
Ruby
mit
11,774
main
469
# frozen_string_literal: true require "set" module Liquid class Deprecations class << self attr_accessor :warned Deprecations.warned = Set.new def warn(name, alternative) return if warned.include?(name) warned << name caller_location = caller_locations(2, 1).first ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/self_drop.rb
Ruby
mit
11,774
main
1,036
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type object # @liquid_name self # @liquid_summary # Provides access to variables through the current scope chain. # @liquid_description # The `self` object resolves variables through the normal lookup hierarchy # (local >...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/file_system.rb
Ruby
mit
11,774
main
2,806
# frozen_string_literal: true module Liquid # A Liquid file system is a way to let your templates retrieve other templates for use with the include tag. # # You can implement subclasses that retrieve templates from the database, from the file system using a different # path structure, you can provide them as h...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/template.rb
Ruby
mit
11,774
main
7,659
# frozen_string_literal: true module Liquid # Templates are central to liquid. # Interpreting templates is a two step process. First you compile the # source code you got. During compile time some extensive error checking is performed. # your code should expect to get some SyntaxErrors. # # After you have ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/errors.rb
Ruby
mit
11,774
main
1,445
# frozen_string_literal: true module Liquid class Error < ::StandardError attr_accessor :line_number attr_accessor :template_name attr_accessor :markup_context def to_s(with_prefix = true) str = +"" str << message_prefix if with_prefix str << super() if markup_context ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/environment.rb
Ruby
mit
11,774
main
5,354
# frozen_string_literal: true module Liquid # The Environment is the container for all configuration options of Liquid, such as # the registered tags, filters, and the default error mode. class Environment # The default error mode for all templates. This can be overridden on a # per-template basis. a...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/range_lookup.rb
Ruby
mit
11,774
main
1,477
# frozen_string_literal: true module Liquid class RangeLookup def self.parse(start_markup, end_markup, string_scanner, cache = nil) start_obj = Expression.parse(start_markup, string_scanner, cache) end_obj = Expression.parse(end_markup, string_scanner, cache) if start_obj.respond_to?(:evaluat...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/document.rb
Ruby
mit
11,774
main
1,448
# frozen_string_literal: true module Liquid class Document def self.parse(tokens, parse_context) doc = new(parse_context) doc.parse(tokens, parse_context) doc end attr_reader :parse_context, :body def initialize(parse_context) @parse_context = parse_context @body = new...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/resource_limits.rb
Ruby
mit
11,774
main
2,709
# frozen_string_literal: true module Liquid class ResourceLimits attr_accessor :render_length_limit, :render_score_limit, :assign_score_limit, :cumulative_render_score_limit, :cumulative_assign_score_limit attr_reader :render_score, :assign_score, :cumulative_render_score,...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/expression.rb
Ruby
mit
11,774
main
3,617
# frozen_string_literal: true module Liquid class Expression SELF = 'self' LITERALS = { nil => nil, 'nil' => nil, 'null' => nil, '' => nil, 'true' => true, 'false' => false, 'blank' => '', 'empty' => '', # in lax mode, minus sign can be a VariableLookup ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/standardfilters.rb
Ruby
mit
11,774
main
34,875
# frozen_string_literal: true require 'cgi' require 'base64' require 'bigdecimal' module Liquid module StandardFilters MAX_I32 = (1 << 31) - 1 private_constant :MAX_I32 supports_64bit_indices = begin [][1 << 33, 1 << 33] true rescue RangeError false end INDEX_RANGE = if su...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/profiler.rb
Ruby
mit
11,774
main
4,060
# frozen_string_literal: true require 'liquid/profiler/hooks' module Liquid # Profiler enables support for profiling template rendering to help track down performance issues. # # To enable profiling, first require 'liquid/profiler'. # Then, to profile a parse/render cycle, pass the <tt>profile: true</tt> opti...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/forloop_drop.rb
Ruby
mit
11,774
main
2,123
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type object # @liquid_name forloop # @liquid_summary # Information about a parent [`for` loop](/docs/api/liquid/tags/for). class ForloopDrop < Drop def initialize(name, length, parentloop) @name = name @leng...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags.rb
Ruby
mit
11,774
main
1,247
# frozen_string_literal: true require_relative "tags/table_row" require_relative "tags/echo" require_relative "tags/if" require_relative "tags/break" require_relative "tags/inline_comment" require_relative "tags/for" require_relative "tags/assign" require_relative "tags/ifchanged" require_relative "tags/case" require_...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/parse_tree_visitor.rb
Ruby
mit
11,774
main
1,036
# frozen_string_literal: true module Liquid class ParseTreeVisitor def self.for(node, callbacks = Hash.new(proc {})) if defined?(node.class::ParseTreeVisitor) node.class::ParseTreeVisitor else self end.new(node, callbacks) end def initialize(node, callbacks) @node...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/i18n.rb
Ruby
mit
11,774
main
979
# frozen_string_literal: true require 'yaml' module Liquid class I18n DEFAULT_LOCALE = File.join(File.expand_path(__dir__), "locales", "en.yml") TranslationError = Class.new(StandardError) attr_reader :path def initialize(path = DEFAULT_LOCALE) @path = path end def translate(name, ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/condition.rb
Ruby
mit
11,774
main
6,018
# frozen_string_literal: true module Liquid # Container for liquid nodes which conveniently wraps decision making logic # # Example: # # c = Condition.new(1, '==', 1) # c.evaluate #=> true # class Condition # :nodoc: @@operators = { '==' => ->(cond, left, right) { cond.send(:equal_variab...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/partial_cache.rb
Ruby
mit
11,774
main
925
# frozen_string_literal: true module Liquid class PartialCache def self.load(template_name, context:, parse_context:) cached_partials = context.registers[:cached_partials] cache_key = "#{template_name}:#{parse_context.error_mode}" cached = cached_partials[cache_key] return cached if cache...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/block_body.rb
Ruby
mit
11,774
main
9,172
# frozen_string_literal: true require 'English' module Liquid class BlockBody LiquidTagToken = /\A\s*(#{TagName})\s*(.*?)\z/o FullToken = /\A#{TagStart}#{WhitespaceControl}?(\s*)(#{TagName})(\s*)(.*?)#{WhitespaceControl}?#{TagEnd}\z/om FullTokenPossiblyInvalid = /\A(.*)#{TagStart}#{Whites...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/drop.rb
Ruby
mit
11,774
main
2,260
# frozen_string_literal: true require 'set' module Liquid # A drop in liquid is a class which allows you to export DOM like things to liquid. # Methods of drops are callable. # The main use for liquid drops is to implement lazy loaded objects. # If you would like to make data available to the web designers wh...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/decrement.rb
Ruby
mit
11,774
main
2,087
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category variable # @liquid_name decrement # @liquid_summary # Creates a new variable, with a default value of -1, that's decreased by 1 with each subsequent call. # # > Caution: # > Predefined Liquid...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/render.rb
Ruby
mit
11,774
main
5,186
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category theme # @liquid_name render # @liquid_summary # Renders a [snippet](/themes/architecture/snippets) or [app block](/themes/architecture/sections/section-schema#render-app-blocks). # @liquid_descriptio...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/unless.rb
Ruby
mit
11,774
main
1,368
# frozen_string_literal: true require_relative 'if' module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category conditional # @liquid_name unless # @liquid_summary # Renders an expression unless a specific condition is `true`. # @liquid_description # > Tip: # > Similar to the [`i...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/ifchanged.rb
Ruby
mit
11,774
main
362
# frozen_string_literal: true module Liquid class Ifchanged < Block def render_to_output_buffer(context, output) block_output = +'' super(context, block_output) if block_output != context.registers[:ifchanged] context.registers[:ifchanged] = block_output output << block_output ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/capture.rb
Ruby
mit
11,774
main
1,675
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category variable # @liquid_name capture # @liquid_summary # Creates a new variable with a string value. # @liquid_description # You can create complex strings with Liquid logic and variables. # # >...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/break.rb
Ruby
mit
11,774
main
668
# frozen_string_literal: true module Liquid # Break tag to be used to break out of a for loop. # # == Basic Usage: # {% for item in collection %} # {% if item.condition %} # {% break %} # {% endif %} # {% endfor %} # # @liquid_public_docs # @liquid_type tag # @liquid_cate...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/for.rb
Ruby
mit
11,774
main
5,958
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category iteration # @liquid_name for # @liquid_summary # Renders an expression for every item in an array. # @liquid_description # You can do a maximum of 50 iterations with a `for` loop. If you need to ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/if.rb
Ruby
mit
11,774
main
3,904
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category conditional # @liquid_name if # @liquid_summary # Renders an expression if a specific condition is `true`. # @liquid_syntax # {% if condition %} # expression # {% endif %} # @liquid_s...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/case.rb
Ruby
mit
11,774
main
4,382
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category conditional # @liquid_name case # @liquid_summary # Renders a specific expression depending on the value of a specific variable. # @liquid_syntax # {% case variable %} # {% when first_value...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/comment.rb
Ruby
mit
11,774
main
2,325
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category syntax # @liquid_name comment # @liquid_summary # Prevents an expression from being rendered or output. # @liquid_description # Any text inside `comment` tags won't be output, and any Liquid code...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/raw.rb
Ruby
mit
11,774
main
1,432
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category syntax # @liquid_name raw # @liquid_summary # Outputs any Liquid code as text instead of rendering it. # @liquid_syntax # {% raw %} # expression # {% endraw %} # @liquid_syntax_keywor...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/cycle.rb
Ruby
mit
11,774
main
4,205
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category iteration # @liquid_name cycle # @liquid_summary # Loops through a group of strings and outputs them one at a time for each iteration of a [`for` loop](/docs/api/liquid/tags/for). # @liquid_descripti...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/increment.rb
Ruby
mit
11,774
main
2,074
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category variable # @liquid_name increment # @liquid_summary # Creates a new variable, with a default value of 0, that's increased by 1 with each subsequent call. # # > Caution: # > Predefined Liquid ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/echo.rb
Ruby
mit
11,774
main
1,071
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category syntax # @liquid_name echo # @liquid_summary # Outputs an expression. # @liquid_description # Using the `echo` tag is the same as wrapping an expression in curly brackets (`{{` and `}}`). However...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/table_row.rb
Ruby
mit
11,774
main
4,265
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category iteration # @liquid_name tablerow # @liquid_summary # Generates HTML table rows for every item in an array. # @liquid_description # The `tablerow` tag must be wrapped in HTML `<table>` and `</tab...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/inline_comment.rb
Ruby
mit
11,774
main
841
# frozen_string_literal: true module Liquid class InlineComment < Tag def initialize(tag_name, markup, options) super # Semantically, a comment should only ignore everything after it on the line. # Currently, this implementation doesn't support mixing a comment with another tag # but we ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/include.rb
Ruby
mit
11,774
main
4,319
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category theme # @liquid_name include # @liquid_summary # Renders a [snippet](/themes/architecture/snippets). # @liquid_description # Inside the snippet, you can access and alter variables that are [creat...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/doc.rb
Ruby
mit
11,774
main
2,238
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category syntax # @liquid_name doc # @liquid_summary # Documents template elements with annotations. # @liquid_description # The `doc` tag allows developers to include documentation within Liquid # te...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/continue.rb
Ruby
mit
11,774
main
482
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category iteration # @liquid_name continue # @liquid_summary # Causes a [`for` loop](/docs/api/liquid/tags/for) to skip to the next iteration. # @liquid_syntax # {% continue %} class Continue < Tag ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tags/assign.rb
Ruby
mit
11,774
main
2,758
# frozen_string_literal: true module Liquid # @liquid_public_docs # @liquid_type tag # @liquid_category variable # @liquid_name assign # @liquid_summary # Creates a new variable. # @liquid_description # You can create variables of any [basic type](/docs/api/liquid/basics#types), [object](/docs/api/...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/profiler/hooks.rb
Ruby
mit
11,774
main
859
# frozen_string_literal: true module Liquid module BlockBodyProfilingHook def render_node(context, output, node) if (profiler = context.profiler) profiler.profile_node(context.template_name, code: node.raw, line_number: node.line_number) do super end else super ...
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tag/disabler.rb
Ruby
mit
11,774
main
248
# frozen_string_literal: true module Liquid class Tag module Disabler def render_to_output_buffer(context, output) context.with_disabled_tags(self.class.disabled_tags) do super end end end end end
github
Shopify/liquid
https://github.com/Shopify/liquid
lib/liquid/tag/disableable.rb
Ruby
mit
11,774
main
606
# frozen_string_literal: true module Liquid class Tag module Disableable def render_to_output_buffer(context, output) if context.tag_disabled?(tag_name) output << disabled_error(context) return end super end def disabled_error(context) # rais...
github
faker-ruby/faker
https://github.com/faker-ruby/faker
Rakefile
Ruby
mit
11,598
main
482
# frozen_string_literal: true $LOAD_PATH.unshift File.dirname(__FILE__) Dir['tasks/**/*.rake'].each { |rake| load rake } require 'bundler' Bundler::GemHelper.install_tasks desc 'Start a console session with Faker loaded' task :console do require 'irb' require 'irb/completion' require 'faker' # You know what t...
github
faker-ruby/faker
https://github.com/faker-ruby/faker
faker.gemspec
Ruby
mit
11,598
main
1,344
# frozen_string_literal: true $LOAD_PATH.push File.expand_path('lib', __dir__) require 'faker/version' Gem::Specification.new do |spec| spec.name = 'faker' spec.version = Faker::VERSION spec.platform = Gem::Platform::RUBY spec.authors = ['Benjamin Curtis', 'Vitor Oliveira'] spec.email ...
github
faker-ruby/faker
https://github.com/faker-ruby/faker
Gemfile
Ruby
mit
11,598
main
464
# frozen_string_literal: true source 'https://rubygems.org' # Specify your gem's dependencies in faker.gemspec gemspec gem 'irb' gem 'minitest', '6.0.5' gem 'minitest-mock' gem 'pry', '0.16.0' gem 'rake', '13.4.2' gem 'rdoc' gem 'rubocop' gem 'rubocop-minitest', '0.39.1' gem 'rubocop-rake', '0.7.1' gem 'simplecov', ...
github
faker-ruby/faker
https://github.com/faker-ruby/faker
tasks/test.rake
Ruby
mit
11,598
main
210
# frozen_string_literal: true require 'rake/testtask' Rake::TestTask.new do |t| t.libs << 'test' t.libs << '.' t.test_files = FileList['test/**/**/test*.rb'] t.warning = true end task default: :test
github
faker-ruby/faker
https://github.com/faker-ruby/faker
tasks/reformat_yaml.rake
Ruby
mit
11,598
main
1,196
# frozen_string_literal: true require 'yaml' desc 'Reformat all locales' task :reformat_locales do path = File.absolute_path(File.join(__dir__, '..', 'lib', 'locales', '**', '*.yml')) locales = Dir[path] failures = [] locales.each do |locale_path| reformat_file(locale_path) rescue StandardError => e ...
github
faker-ruby/faker
https://github.com/faker-ruby/faker
test/test_en_ind_locale.rb
Ruby
mit
11,598
main
1,016
# frozen_string_literal: true require_relative 'test_helper' class TestEnIndLocale < Test::Unit::TestCase def setup @previous_locale = Faker::Config.locale Faker::Config.locale = 'en-IND' end def teardown Faker::Config.locale = @previous_locale end def test_en_ind_address_methods assert_ki...
github
faker-ruby/faker
https://github.com/faker-ruby/faker
test/test_en_nep_locale.rb
Ruby
mit
11,598
main
1,231
# frozen_string_literal: true require_relative 'test_helper' class TestEnNepLocale < Test::Unit::TestCase def setup Faker::Config.locale = 'en-NEP' end def teardown Faker::Config.locale = nil end def test_en_nep_address_methods assert_kind_of String, Faker::Address.default_time_zone assert...
github
faker-ruby/faker
https://github.com/faker-ruby/faker
test/test_en_locale.rb
Ruby
mit
11,598
main
2,058
# frozen_string_literal: true require_relative 'test_helper' class TestEnLocale < Test::Unit::TestCase def setup Faker::Config.locale = 'en' end def teardown Faker::Config.locale = nil end def test_us_states_only_include_states assert_equal(['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'Califor...
github
faker-ruby/faker
https://github.com/faker-ruby/faker
test/test_nl_locale.rb
Ruby
mit
11,598
main
2,499
# frozen_string_literal: true require_relative 'test_helper' class TestNlLocale < Test::Unit::TestCase def setup @previous_locale = Faker::Config.locale Faker::Config.locale = 'nl' end def teardown Faker::Config.locale = nil end def test_nl_address_methods assert_kind_of String, Faker::Add...
github
faker-ruby/faker
https://github.com/faker-ruby/faker
test/test_fr_ca_locale.rb
Ruby
mit
11,598
main
2,754
# frozen_string_literal: true require_relative 'test_helper' class TestFrCaLocale < Test::Unit::TestCase def setup @previous_locale = Faker::Config.locale @standard_wordlist = I18n.translate('faker.lorem.words') @complete_wordlist = @standard_wordlist + I18n.translate('faker.lorem.supplemental') ...
github
faker-ruby/faker
https://github.com/faker-ruby/faker
test/test_en_ca_locale.rb
Ruby
mit
11,598
main
2,334
# frozen_string_literal: true require_relative 'test_helper' class TestEnCaLocale < Test::Unit::TestCase def setup @previous_locale = Faker::Config.locale Faker::Config.locale = 'en-CA' end def teardown Faker::Config.locale = @previous_locale end def test_en_ca_address_methods assert_kind_...