class Liquid::Drop::Str
Constants
- VERSION
Attributes
context[W]
Public Class Methods
invokable?(m)
click to toggle source
– This is `.invokable?` when it comes to Liquids own
source. We change it to discourage users from overriding the methods because this is a wrapper.
–
# File lib/liquid/drop/str.rb, line 50 def self.invokable?(m) invokable_methods.include?(m.to_s) end
invokable_methods()
click to toggle source
–
# File lib/liquid/drop/str.rb, line 55 def self.invokable_methods @invokable_methods ||= begin Set.new(good.map(&:to_s)) end end
Private Class Methods
bad()
click to toggle source
# File lib/liquid/drop/str.rb, line 62 def self.bad @bad ||= begin bad = [] bad = bad | Drop.public_instance_methods bad = bad | Array.public_instance_methods bad = bad | Enumerable.public_instance_methods bad = bad | String.public_instance_methods bad = bad | Hash.public_instance_methods end end
good()
click to toggle source
# File lib/liquid/drop/str.rb, line 73 def self.good @good ||= [:to_liquid] | ( public_instance_methods - bad ) end
Public Instance Methods
invoke_drop(m)
click to toggle source
– Invokes a method on the drop if it exist and is
not blacklisted. We blacklist most methods by default if it's on `String`, `Array`, `Enumberable` `Hash` and this own class...
–
# File lib/liquid/drop/str.rb, line 31 def invoke_drop(m) self.class.invokable?(m) ? send(m) : liquid_method_missing(m) end
Also aliased as: []
is_a?(v)
click to toggle source
– Mocks `#is_a?` so that Liquid
thinks we are a
drop. If it ever decides to ask.
–
Calls superclass method
# File lib/liquid/drop/str.rb, line 10 def is_a?(v) v == Liquid::Drop || super(v) end
Also aliased as: ===
key?(_)
click to toggle source
–
# File lib/liquid/drop/str.rb, line 41 def key?(_) true end
liquid_method_missing(method)
click to toggle source
– Liquid
version of `method_missing`, except it only
works for Liquid and only takes the method.
@return Error. –
# File lib/liquid/drop/str.rb, line 19 def liquid_method_missing(method) return nil unless @context && @context.strict_variables raise Liquid::UndefinedDropMethod, \ "undefined method #{method}" end
to_liquid()
click to toggle source
–
# File lib/liquid/drop/str.rb, line 36 def to_liquid self end