Sha256: 0126aa635254279c2155df2ba6d6d282aad0c836129671280b86ddde69919f68
Contents?: true
Size: 1.76 KB
Versions: 2
Compression:
Stored size: 1.76 KB
Contents
module Virtus class Attribute # Accessor object providing reader and writer methods # # @api private class Accessor #include Adamantium::Flat # Return reader # # @return [Reader] # # @api private attr_reader :reader # Return writer # # @return [Writer] # # @api private attr_reader :writer # Build an accessor instance # # @param [Symbol] name # # @param [Class] type # # @param [Hash] options # # @return [Accessor] # # @api private def self.build(*args) Builder.call(*args) end # Initialize a new accessor instance # # @param [Reader] # # @param [Writer] # # @return [undefined] # # @api private def initialize(reader, writer) @reader, @writer = reader, writer end # Get a variable value from an object # # @return [Object] # # @api private def get(instance) reader.call(instance) end # Set a variable on an object # # @return [Object] # # @api private def set(*args) writer.call(*args) end # Return if reader method is public # # @return [Boolean] # # @api private def public_reader? reader.public? end # Return if writer method is public # # @return [Boolean] # # @api private def public_writer? writer.public? end # Return if this accessor is lazy # # @return [FalseClass] # # @api private def lazy? false end end # class Accessor end # class Attribute end # module Virtus
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
motion_virtus-1.0.0.beta0.1 | lib/project/attribute/accessor.rb |
motion_virtus-1.0.0.beta0 | lib/project/attribute/accessor.rb |