Class: TeamsConnector::Builder
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #container {|@content| ... } ⇒ Object
- #facts {|@content| ... } ⇒ Object
-
#initialize {|_self| ... } ⇒ Builder
constructor
A new instance of Builder.
- #result ⇒ Object
- #text(text) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Builder
Returns a new instance of Builder.
7 8 9 |
# File 'lib/teams_connector/builder.rb', line 7 def initialize yield self end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
5 6 7 |
# File 'lib/teams_connector/builder.rb', line 5 def content @content end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/teams_connector/builder.rb', line 5 def type @type end |
Class Method Details
.container(&block) ⇒ Object
20 21 22 |
# File 'lib/teams_connector/builder.rb', line 20 def self.container(&block) TeamsConnector::Builder.new { |entry| entry.container(&block) } end |
.facts(&block) ⇒ Object
30 31 32 |
# File 'lib/teams_connector/builder.rb', line 30 def self.facts(&block) TeamsConnector::Builder.new { |entry| entry.facts(&block) } end |
.text(text) ⇒ Object
11 12 13 |
# File 'lib/teams_connector/builder.rb', line 11 def self.text(text) TeamsConnector::Builder.new { |entry| entry.text text } end |
Instance Method Details
#container {|@content| ... } ⇒ Object
24 25 26 27 28 |
# File 'lib/teams_connector/builder.rb', line 24 def container @type = :container @content = [] yield @content end |
#facts {|@content| ... } ⇒ Object
34 35 36 37 38 |
# File 'lib/teams_connector/builder.rb', line 34 def facts @type = :facts @content = {} yield @content end |
#result ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/teams_connector/builder.rb', line 40 def result case @type when :container result_container when :facts result_facts when :text result_text else raise TypeError, "The type #{@type} is not supported by the TeamsConnector::Builder" end end |
#text(text) ⇒ Object
15 16 17 18 |
# File 'lib/teams_connector/builder.rb', line 15 def text(text) @type = :text @content = text end |