Class: Markbridge::AST::Poll
Overview
Represents a Discourse poll.
Instance Attribute Summary collapse
-
#chart_type ⇒ String?
readonly
Chart type (bar, pie).
-
#name ⇒ String
readonly
The poll name/identifier.
-
#options ⇒ Array<String>
readonly
Poll options.
-
#public ⇒ Boolean
readonly
Whether votes are public.
-
#raw ⇒ String?
readonly
The original raw BBCode.
-
#results ⇒ String?
readonly
When to show results (always, on_vote, on_close, staff_only).
-
#type ⇒ String?
readonly
Poll type (regular, multiple, number).
Instance Method Summary collapse
-
#initialize(name: "poll", type: nil, results: nil, public: false, chart_type: nil, options: [], raw: nil) ⇒ Poll
constructor
Create a new Poll node.
Constructor Details
#initialize(name: "poll", type: nil, results: nil, public: false, chart_type: nil, options: [], raw: nil) ⇒ Poll
Create a new Poll node.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/markbridge/ast/poll.rb', line 55 def initialize( name: "poll", type: nil, results: nil, public: false, chart_type: nil, options: [], raw: nil ) @name = name @type = type @results = results @public = public @chart_type = chart_type @options = @raw = raw end |
Instance Attribute Details
#chart_type ⇒ String? (readonly)
Returns chart type (bar, pie).
38 39 40 |
# File 'lib/markbridge/ast/poll.rb', line 38 def chart_type @chart_type end |
#name ⇒ String (readonly)
Returns the poll name/identifier.
26 27 28 |
# File 'lib/markbridge/ast/poll.rb', line 26 def name @name end |
#options ⇒ Array<String> (readonly)
Returns poll options.
41 42 43 |
# File 'lib/markbridge/ast/poll.rb', line 41 def @options end |
#public ⇒ Boolean (readonly)
Returns whether votes are public.
35 36 37 |
# File 'lib/markbridge/ast/poll.rb', line 35 def public @public end |
#raw ⇒ String? (readonly)
Returns the original raw BBCode.
44 45 46 |
# File 'lib/markbridge/ast/poll.rb', line 44 def raw @raw end |
#results ⇒ String? (readonly)
Returns when to show results (always, on_vote, on_close, staff_only).
32 33 34 |
# File 'lib/markbridge/ast/poll.rb', line 32 def results @results end |
#type ⇒ String? (readonly)
Returns poll type (regular, multiple, number).
29 30 31 |
# File 'lib/markbridge/ast/poll.rb', line 29 def type @type end |