Sha256: a85c1b66c9dacad0e5e5cd47999224b54f31a1c7a3fa54b06a109a14d97f3c66
Contents?: true
Size: 879 Bytes
Versions: 9
Compression:
Stored size: 879 Bytes
Contents
module Virtus class Attribute class DefaultValue # Represents default value evaluated via a symbol # # @api private class FromSymbol < DefaultValue # Return if the class can handle the value # # @param [Object] value # # @return [Boolean] # # @api private def self.handle?(value) value.is_a?(::Symbol) end # Evaluates the value via instance#public_send(value) # # Symbol value is returned if the instance doesn't respond to value # # @return [Object] evaluated value # # @api private def call(instance, *) instance.respond_to?(@value) ? instance.public_send(@value) : @value end end # class FromSymbol end # class DefaultValue end # class Attribute end # module Virtus
Version data entries
9 entries across 9 versions & 2 rubygems