#------------------------------------------------------------------------------- # Author: Keith Brings # Copyright (C) 2018 Noizu Labs, Inc. All rights reserved. #------------------------------------------------------------------------------- defmodule Noizu.RuleEngine.Op.NotOp do @type t :: %__MODULE__{ name: String.t | nil, description: String.t | nil, identifier: String.t | list | tuple, # Materialized Path. argument: any, } defstruct [ name: nil, description: nil, identifier: nil, argument: nil, ] end defimpl Noizu.RuleEngine.ScriptProtocol, for: Noizu.RuleEngine.Op.NotOp do alias Noizu.RuleEngine.Helper #----------------- # execute!/3 #----------------- def execute!(this, state, context), do: execute!(this, state, context, %{}) #----------------- # execute!/4 #----------------- def execute!(this, state, context, options) do {o, s} = Noizu.RuleEngine.ScriptProtocol.execute!(this.argument, state, context, options) {!o, s} end #--------------------- # identifier/3 #--------------------- def identifier(this, _state, _context), do: Helper.identifier(this) #--------------------- # identifier/4 #--------------------- def identifier(this, _state, _context, _options), do: Helper.identifier(this) #--------------------- # render/3 #--------------------- def render(this, state, context), do: Helper.render_arg_list("NOT", identifier(this, state, context), [this.argument], state, context, %{}) #--------------------- # render/4 #--------------------- def render(this, state, context, options), do: Helper.render_arg_list("NOT", identifier(this, state, context, options), [this.argument], state, context, options) end