Class: HakumiComponents::Table::FixedOffset
- Inherits:
-
Object
- Object
- HakumiComponents::Table::FixedOffset
- Extended by:
- T::Sig
- Defined in:
- app/components/hakumi_components/table/fixed_offset.rb
Constant Summary collapse
- SIDES =
T.let(%i[left right].freeze, T::Array[Symbol])
Instance Attribute Summary collapse
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#side ⇒ Object
readonly
Returns the value of attribute side.
Instance Method Summary collapse
- #[](name) ⇒ Object
-
#initialize(side:, offset:) ⇒ FixedOffset
constructor
A new instance of FixedOffset.
Constructor Details
#initialize(side:, offset:) ⇒ FixedOffset
Returns a new instance of FixedOffset.
12 13 14 15 16 17 |
# File 'app/components/hakumi_components/table/fixed_offset.rb', line 12 def initialize(side:, offset:) raise ArgumentError, "Invalid fixed side: #{side.inspect}" unless SIDES.include?(side) @side = T.let(side, Symbol) @offset = T.let(offset, Float) end |
Instance Attribute Details
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
23 24 25 |
# File 'app/components/hakumi_components/table/fixed_offset.rb', line 23 def offset @offset end |
#side ⇒ Object (readonly)
Returns the value of attribute side.
20 21 22 |
# File 'app/components/hakumi_components/table/fixed_offset.rb', line 20 def side @side end |
Instance Method Details
#[](name) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/components/hakumi_components/table/fixed_offset.rb', line 26 def [](name) case name when :side then @side when :offset then @offset else raise ArgumentError, "Unknown fixed offset key: #{name.inspect}" end end |