Skip to contents

ContentBlock

ContentBlock

Methods


Method new()

Returns a ContentBlock object.

Usage

Details

Returns a ContentBlock object with no content and the default style.

Returns

ContentBlock

Examples

ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
ContentBlock$new()


Method set_content()

Sets content of this ContentBlock.

Usage

ContentBlock$set_content(content)

Arguments

content

(character(0) or character(1)) a string literal or a file path assigned to this ContentBlock

Returns

invisibly self

Examples

ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
block <- ContentBlock$new()
block$set_content("Base64 encoded picture")


Method get_content()

Returns the absolute path to content of this ContentBlock

Usage

ContentBlock$get_content()

Returns

character content of this ContentBlock

Examples

ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
block <- ContentBlock$new()
block$get_content()


Method from_list()

Create the ContentBlock from a list.

Usage

ContentBlock$from_list(x)

Arguments

x

named list with two fields c("text", "style"). Use the get_available_styles method to get all possible styles.

Returns

invisibly self


Method to_list()

Convert the ContentBlock to a list.

Usage

ContentBlock$to_list()

Returns

named list with a text and style.


Method clone()

The objects of this class are cloneable with this method.

Usage

ContentBlock$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `ContentBlock$new`
## ------------------------------------------------

ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
ContentBlock$new()
#> <ContentBlock>
#>   Public:
#>     clone: function (deep = FALSE) 
#>     from_list: function (x) 
#>     get_content: function () 
#>     initialize: function () 
#>     set_content: function (content) 
#>     to_list: function () 
#>   Private:
#>     content: 
#>     deep_clone: function (name, value) 


## ------------------------------------------------
## Method `ContentBlock$set_content`
## ------------------------------------------------

ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
block <- ContentBlock$new()
block$set_content("Base64 encoded picture")


## ------------------------------------------------
## Method `ContentBlock$get_content`
## ------------------------------------------------

ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
block <- ContentBlock$new()
block$get_content()
#> character(0)