module Bali::Statics::ScopeRuler

Public Instance Methods

rule_scope(arg1, arg2 = nil) click to toggle source
# File lib/bali/statics/scope_ruler.rb, line 26
def rule_scope(arg1, arg2 = nil)
  data, actor = HelperFunctions.extract_data_and_actor(self, arg1, arg2)
  return unless data

  scope = HelperFunctions.scope_for(data)
  scoped_data = case scope.arity
                when 0 then scope.call
                when 1 then scope.call(data)
                when 2 then scope.call(data, actor)
                end

  scoped_data || data
end