Class: Line::Message::Builder::Flex::Separator
- Includes:
- Position::Margin
- Defined in:
- lib/line/message/builder/flex/separator.rb
Overview
Represents a separator component in a LINE Flex Message.
Separator components are used to create a visual separation between components within a container. They draw a horizontal line that helps organize the layout and improve readability.
Example
Line::Message::Builder.with do
flex alt_text: "Separator Example" do
bubble do
body do
text "Section 1"
separator
text "Section 2"
end
end
end
end
Example: Spacing and tinting the line
Line::Message::Builder.with do
flex alt_text: "Separator Example" do
bubble do
body do
text "Section 1"
separator margin: :xl, color: "#F0F0F0"
text "Section 2"
end
end
end
end
See also:
- https://developers.line.biz/en/reference/messaging-api/#separator
- Position::Margin for the
marginproperty
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#to_h ⇒ Object
Converts the separator component to a hash representation compatible with the LINE Messaging API.
Methods included from Position::Margin
Methods inherited from Base
inherited, #initialize, #method_missing, #quick_reply, #respond_to_missing?
Constructor Details
This class inherits a constructor from Line::Message::Builder::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Line::Message::Builder::Base
Instance Method Details
#to_h ⇒ Object
Converts the separator component to a hash representation compatible with the LINE Messaging API.
The margin and color properties share the same name in both the API
and SDK v2 formats, so a single representation serves both.
Returns a hash containing the separator component's type and any set properties.
Example
separator = Separator.new(margin: :md)
separator.to_h
# => { type: "separator", margin: :md }
72 73 74 75 76 77 78 79 |
# File 'lib/line/message/builder/flex/separator.rb', line 72 def to_h { type: "separator", # Position::Margin margin: margin, color: color # From option }.compact end |