Class: HakumiComponents::Calendar::EventEntry
- Inherits:
-
Object
- Object
- HakumiComponents::Calendar::EventEntry
- Extended by:
- T::Sig
- Defined in:
- app/components/hakumi_components/calendar/event_entry.rb
Constant Summary collapse
- InputValue =
T.type_alias { T.nilable(T.any(String, Symbol, Integer)) }
- InputAttributes =
T.type_alias { T::Hash[Symbol, InputValue] }
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id: nil, type: :default, content: nil) ⇒ EventEntry
constructor
A new instance of EventEntry.
Constructor Details
#initialize(id: nil, type: :default, content: nil) ⇒ EventEntry
Returns a new instance of EventEntry.
13 14 15 16 17 |
# File 'app/components/hakumi_components/calendar/event_entry.rb', line 13 def initialize(id: nil, type: :default, content: nil) @id = T.let(id, T.nilable(String)) @type = T.let(type, Symbol) @content = T.let(content, T.nilable(String)) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
20 21 22 |
# File 'app/components/hakumi_components/calendar/event_entry.rb', line 20 def content @content end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
20 21 22 |
# File 'app/components/hakumi_components/calendar/event_entry.rb', line 20 def id @id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
23 24 25 |
# File 'app/components/hakumi_components/calendar/event_entry.rb', line 23 def type @type end |
Class Method Details
.coerce(event) ⇒ Object
31 32 33 34 35 36 37 |
# File 'app/components/hakumi_components/calendar/event_entry.rb', line 31 def self.coerce(event) new( id: event[:id]&.to_s, type: coerce_type(event[:type]), content: event[:content]&.to_s ) end |
.coerce_all(events) ⇒ Object
26 27 28 |
# File 'app/components/hakumi_components/calendar/event_entry.rb', line 26 def self.coerce_all(events) events.map { |event| coerce(event) } end |