Module: Line::Message::Builder::Flex::Position::Offset

Included in:
Box, Button, Icon, Image, Text
Defined in:
lib/line/message/builder/flex/position.rb

Overview

Provides options for positioning components using offsets, either absolutely or relatively to their normal position.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



249
250
251
252
253
254
255
256
257
258
259
# File 'lib/line/message/builder/flex/position.rb', line 249

def self.included(base)
  base.option :position,
              default: nil, # LINE API default is :relative if offsets are used
              validator: Validators::Enum.new(:absolute, :relative)

  %i[offset_top offset_bottom offset_start offset_end].each do |option_name|
    base.option option_name, # e.g., maps to `offsetTop` in JSON
                default: nil,
                validator: Validators::Size.new(:pixel, :keyword)
  end
end