Class: Markbridge::AST::Event

Inherits:
Node
  • Object
show all
Defined in:
lib/markbridge/ast/event.rb

Overview

Represents a Discourse event.

Examples:

Basic event

event = AST::Event.new(
  name: "Team Meeting",
  starts_at: "2025-12-15 14:00"
)

Event with all attributes

event = AST::Event.new(
  name: "Conference",
  starts_at: "2025-12-15 09:00",
  ends_at: "2025-12-15 17:00",
  status: "public",
  timezone: "Europe/Vienna",
  raw: "[event name=\"Conference\"]...[/event]"
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, starts_at:, ends_at: nil, status: nil, timezone: nil, raw: nil) ⇒ Event

Create a new Event node.

Parameters:

  • name (String)

    the event name

  • starts_at (String)

    start date/time

  • ends_at (String, nil) (defaults to: nil)

    end date/time

  • status (String, nil) (defaults to: nil)

    event status

  • timezone (String, nil) (defaults to: nil)

    timezone

  • raw (String, nil) (defaults to: nil)

    the original raw BBCode



49
50
51
52
53
54
55
56
# File 'lib/markbridge/ast/event.rb', line 49

def initialize(name:, starts_at:, ends_at: nil, status: nil, timezone: nil, raw: nil)
  @name = name
  @starts_at = starts_at
  @ends_at = ends_at
  @status = status
  @timezone = timezone
  @raw = raw
end

Instance Attribute Details

#ends_atString? (readonly)

Returns end date/time.

Returns:

  • (String, nil)

    end date/time



30
31
32
# File 'lib/markbridge/ast/event.rb', line 30

def ends_at
  @ends_at
end

#nameString (readonly)

Returns the event name.

Returns:

  • (String)

    the event name



24
25
26
# File 'lib/markbridge/ast/event.rb', line 24

def name
  @name
end

#rawString? (readonly)

Returns the original raw BBCode.

Returns:

  • (String, nil)

    the original raw BBCode



39
40
41
# File 'lib/markbridge/ast/event.rb', line 39

def raw
  @raw
end

#starts_atString (readonly)

Returns start date/time.

Returns:

  • (String)

    start date/time



27
28
29
# File 'lib/markbridge/ast/event.rb', line 27

def starts_at
  @starts_at
end

#statusString? (readonly)

Returns event status (public, private, standalone).

Returns:

  • (String, nil)

    event status (public, private, standalone)



33
34
35
# File 'lib/markbridge/ast/event.rb', line 33

def status
  @status
end

#timezoneString? (readonly)

Returns timezone.

Returns:

  • (String, nil)

    timezone



36
37
38
# File 'lib/markbridge/ast/event.rb', line 36

def timezone
  @timezone
end