Module: Forwarder::Evaller
Constant Summary collapse
- NotSerializable =
Class.new RuntimeError
Instance Method Summary collapse
- #evaluable?(an_object, cache = {}) ⇒ Boolean
- #serialize(args) ⇒ Object
- #serialize_without_arg_suffix(args, cache = {}) ⇒ Object
Instance Method Details
#evaluable?(an_object, cache = {}) ⇒ Boolean
6 7 8 9 10 |
# File 'lib/forwarder/evaller.rb', line 6 def evaluable? an_object, cache={} !!_serialize_one( an_object, cache ) rescue NotSerializable false end |
#serialize(args) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/forwarder/evaller.rb', line 12 def serialize args return "" if args.nil? || args.empty? serialize_without_arg_suffix( args ).join(", ") + ", " rescue NotSerializable nil end |
#serialize_without_arg_suffix(args, cache = {}) ⇒ Object
19 20 21 22 23 |
# File 'lib/forwarder/evaller.rb', line 19 def serialize_without_arg_suffix args, cache={} args.map{ | arg | _serialize_one arg, cache } end |