No commit activity in last 3 years
No release in over 3 years
A drop that wraps hashes and arrays.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Donate

Liquid String Drop

Provides a drop that is both a string and a drop so that you can embed them in hashes, replace pieces of of build systems with drops and optimize your code for speed/efficiency.

Usage

require "liquid/drop/str"
class MyDrop < Liquid::Drop::Str
  attr_reader :other

  def initialize(val, other:)
    @other = other
    super(val)
  end
end

a = {
  MyDrop.new("hello", other: "world") => "Yup."
}

# pry(main) > a["hello"] # => "Yup."
# pry(main) > a.keys.fetch(0).other
#   => "world"

Usefulness

This Gem is particularly useful for replacing parts of Jekyll's core with drops of your own. Here I use it to replace Jekyll's tags with my own tag generator and a set of drops. This makes it so that anybody who uses Jekyll::Site#tags can continue to use string keys (as expected) but internally when I use it in Liquid, I have all the data that I embedded.