Sha256: 1f9039b5650d53cbc9e25fb75e6ff32c9dba41c4f4666911a67e6d72cfb7a976
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
module Virtus class Attribute # Abstract accessor method class # # @api public # # @abstract class AccessorMethod #include Adamantium::Flat #include AbstractType #abstract_method :call def call(*) raise NotImplementedError, "#{self.class.inspect}##{name} is not implemented" end #abstract_method :define_method def call(*) raise NotImplementedError, "#{self.class.inspect}##{name} is not implemented" end # Return name # # @return [Symbol] # # @api private attr_reader :name # Return visibility # # @return [Symbol] # # @api private attr_reader :visibility # Return instance variable name # # @return [Symbol] # # @api private attr_reader :instance_variable_name # Initialize accessor method instance # # @param [#to_sym] name # # @param [Hash] options # # @return [undefined] # # @api private def initialize(name, options = {}) @name = name.to_sym @visibility = options.fetch(:visibility, :public) @instance_variable_name = "@#{name}".to_sym end # Return if the accessor is public # # @return [TrueClass,FalseClass] # # @api private def public? visibility == :public end end # class AccessorMethod 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_method.rb |
motion_virtus-1.0.0.beta0 | lib/project/attribute/accessor_method.rb |