YamlContext.ObjectReference.S3: Class: YamlContext.ObjectReference.S3

Description Usage Arguments Value Fields Intended use of this class Author(s) References Examples

Description

Class representing the reactive reference context with respect to processing YAML markup.

Usage

1
2
YamlContext.ObjectReference.S3(.x, ctx = "YamlContext.ObjectReference.S3",
  pattern = ".*object-ref:\\s+\\{\\s*id\\s*:\\s+\\w+.*\\}")

Arguments

.x

ANY. An object of an arbitrary class whose class attribute should be updated so that it becomes an instance of class YamlContext.ObjectReference.S3. Mainly intended for rapid prototyping purposes

Value

Instance of class YamlContext.ObjectReference.S3.

Fields

ctx

character. Context ID. Corresponds to the class name. Initial: "YamlContext.ObjectReference.S3".

pattern

character. Pattern to recognize YAML markup. Initial: ".*object-ref:\s+\{\s*id\s*:\s+\w+.*\}".

Intended use of this class

This S3 class, or to be more precise its constructor function, exists mainly for rapid prototyping purposes. This is mainly reflected in the fact, that when specifying .x, this constructor function will simply update the class attribute of whatever object has been provided.

However, it also allows for a more formal OOP-style of rapid prototyping by offering explicit class fields (all arguments except .x). Nevertheless, it is probably advisable to switch to an explicit formal approach such as S4 and/or Reference Classes once the package or application has reached a certain state of maturity.

Author(s)

Janko Thyson janko.thyson@rappster.de

References

http://github.com/Rappster/yamlr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 

## Informal use (intended mainly for rapid prototyping) //
## Takes *any* object and simply changes the class attributes
YamlContext.ObjectReference.S3(
  list(
    ctx = "abcd"
  )
)  
YamlContext.ObjectReference.S3(TRUE)  

## Formal use (explicitly using 'fields') //
res <- YamlContext.ObjectReference.S3()
ls(res)
res$ctx
res <- YamlContext.ObjectReference.S3(
  ctx = "YamlContext.ObjectReference.S3"
)
res$ctx

## Recommended: include namespace //
## Regardless if you plan on using this class in an informal or formal way
yamlr::YamlContext.ObjectReference.S3()


## End(Not run)

rappster/yamlr documentation built on May 27, 2019, 2:02 a.m.