<aside> πŸ‘‰ Links (Controller base class)

DiscussionThread

NotionCache

PropertyCache

Query

RichTextArray

Notion Ruby Mapping Public API Reference

</aside>

<aside> ℹ️ ↑ Table of Contents

</aside>

Some properties and Database title have an array of RichTextObject. RichTextArray is the delegate class for the array of RichTextObject. Moreover, some methods of TitleProperty, RichTextProperty and Database.title delegate to the included RichTextArray.

1. Singleton methods

rich_text_array(key, text_info = [])

RichTextArray can be created by a String, some Strings, a RichTextObject and some RichTextObjects. RichTextArray has Array of RichTextObjects. String values will convert to simple TextObjects. If string_contes is already RichTextArray, this method returns the given the RichTextArray.

nullString = RichTextArray.rich_text_array "title"
aString = RichTextArray.rich_text_array "title", "A string"
twoStrings = RichTextArray.rich_text_array "title", %W[ABC\\\\n DEF]
aTextObject = RichTextArray.rich_text_array "title", TextObject.new("A TextObject")
textMentionObjects = RichTextArray.rich_text_array "title", [TextObject.new("A TextObject"), MentionObject.new(user_id: "ABC")]
richTextArray = RichTextArray.rich_text_array "title", textMentionObjects # richTextArray == textMentionObjects

↑ Table of Contents

2. Instance methods

<<(value) β†’ RichTextObject

<< appends a text or RichTextObject. String value will convert to simple TextObject.

db.database_title << "title"
db.database_title << MentionObject.new(user_id: "AAA")

↑ Table of Contents

self[pos] β†’ RichTextObject

self[pos] returns a RichTextObject.

↑ Table of Contents