class Rox::Core::PropertiesExtensions
Public Class Methods
new(parser, properties_repository, dynamic_property_rule_handler = nil)
click to toggle source
# File lib/rox/core/repositories/roxx/properties_extensions.rb, line 8 def initialize(parser, properties_repository, dynamic_property_rule_handler = nil) @parser = parser @properties_repository = properties_repository @dynamic_property_rule_handler = dynamic_property_rule_handler end
Public Instance Methods
extend()
click to toggle source
# File lib/rox/core/repositories/roxx/properties_extensions.rb, line 14 def extend @parser.add_operator('property') do |_parser, stack, context| prop_name = stack.pop.to_s property = @properties_repository.custom_property(prop_name) value = get_value(prop_name, property, context) stack.push(value.nil? ? TokenType::UNDEFINED : value) end end
Private Instance Methods
get_value(prop_name, property, context)
click to toggle source
# File lib/rox/core/repositories/roxx/properties_extensions.rb, line 26 def get_value(prop_name, property, context) if property.nil? if @dynamic_property_rule_handler.nil? TokenType::UNDEFINED else get_value_from_dynamic_property_rule_handler(prop_name, context) end else get_value_from_property(property, context) end end
get_value_from_dynamic_property_rule_handler(prop_name, context)
click to toggle source
# File lib/rox/core/repositories/roxx/properties_extensions.rb, line 38 def get_value_from_dynamic_property_rule_handler(prop_name, context) @dynamic_property_rule_handler.call(prop_name, context) rescue StandardError => e raise Rox::Core::UserspaceHandlerException, handler, ExceptionTrigger::DYNAMIC_PROPERTIES_RULE, e end
get_value_from_property(property, context)
click to toggle source
# File lib/rox/core/repositories/roxx/properties_extensions.rb, line 44 def get_value_from_property(property, context) property.value(context) rescue StandardError => e raise Rox::Core::UserspaceHandlerException, handler, ExceptionTrigger::CUSTOM_PROPERTY_GENERATOR, e end