len.bandicoot_oop: S3 method of computing the length of 'bandicoot_oop' object

View source: R/oop_s3.R

len.bandicoot_oopR Documentation

S3 method of computing the length of bandicoot_oop object

Description

This function computes the length of the object by using the ..len..() method. If it is not applicable, error will be raised.

Usage

## S3 method for class 'bandicoot_oop'
len(x, ...)

Arguments

x

bandicoot_oop object.

...

ignored.

Value

An integer.

Examples

EMAIL <- new_class(class_name = "EMAIL")
email <- EMAIL$instantiate
register_method(EMAIL, ..init.. = function(address) self$address = address)
register_method(EMAIL, ..len.. = function() nchar(self$address))

patrick <- email('patrick@test.com')
len(patrick)


bandicoot documentation built on May 29, 2024, 8:01 a.m.