Method: NotionRubyMapping::TextProperty#initialize

Defined in:
lib/notion_ruby_mapping/properties/text_property.rb

#initialize(name, will_update: false, base_type: "page", json: nil, text_objects: nil, property_id: nil, property_cache: nil, query: nil) ⇒ TextProperty

Returns a new instance of TextProperty.

Parameters:

  • name (String, Symbol)
  • json (Hash, Array) (defaults to: nil)
  • text_objects (Array<RichTextObject>) (defaults to: nil)

Raises:

  • (StandardError)


30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/notion_ruby_mapping/properties/text_property.rb', line 30

def initialize(name, will_update: false, base_type: "page", json: nil, text_objects: nil, property_id: nil,
               property_cache: nil, query: nil)
  raise StandardError, "TextObject is abstract class.  Please use RichTextProperty." if instance_of? TextProperty

  super name, will_update: will_update, base_type: base_type, property_id: property_id,
              property_cache: property_cache, query: query
  @text_objects = if database_or_data_source?
                    json || {}
                  else
                    RichTextArray.new "title", json: json, text_objects: text_objects
                  end
end