Module: Cel::CelMethods::ClassMethods

Defined in:
lib/cel/ast/cel_methods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cel_methodsObject (readonly)

Returns the value of attribute cel_methods.



16
17
18
# File 'lib/cel/ast/cel_methods.rb', line 16

def cel_methods
  @cel_methods
end

Instance Method Details

#define_cel_method(meth, &blk) ⇒ Object



18
19
20
21
22
23
# File 'lib/cel/ast/cel_methods.rb', line 18

def define_cel_method(meth, &blk)
  Ractor.make_shareable(blk) if defined?(Ractor)
  define_method(meth, &blk)

  @cel_methods << meth # rubocop:disable ThreadSafety/ClassInstanceVariable
end

#freeze(*a) ⇒ Object



31
32
33
34
# File 'lib/cel/ast/cel_methods.rb', line 31

def freeze(*a)
  super
  @cel_methods.freeze(*a) # rubocop:disable ThreadSafety/ClassInstanceVariable
end

#inherited(klass) ⇒ Object



25
26
27
28
29
# File 'lib/cel/ast/cel_methods.rb', line 25

def inherited(klass)
  super

  klass.instance_variable_set(:@cel_methods, [])
end