Class: Alf::Lang::Parser::Safer
- Inherits:
-
Object
- Object
- Alf::Lang::Parser::Safer
- Includes:
- Alf::Lang::Parser
- Defined in:
- lib/alf/lang/parser/safer.rb
Defined Under Namespace
Classes: Policy
Instance Method Summary collapse
-
#initialize(helpers = [], connection = nil) ⇒ Safer
constructor
A new instance of Safer.
- #parse(expr = nil, *rest, &bl) ⇒ Object
Constructor Details
Instance Method Details
#parse(expr = nil, *rest, &bl) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/alf/lang/parser/safer.rb', line 12 def parse(expr = nil, *rest, &bl) if expr.nil? and bl raise SecurityError, "Parsing of ruby blocks forbidden" end return expr if expr.is_a?(Algebra::Operand) check_safety!(expr.to_s) @lispy.parse(expr.to_s, *rest, &bl) end |