Class: Mayu::VDOM::ComponentMarshaler
- Inherits:
-
Object
- Object
- Mayu::VDOM::ComponentMarshaler
- Extended by:
- T::Sig
- Defined in:
- lib/mayu/vdom/component_marshaler.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type) ⇒ ComponentMarshaler
constructor
A new instance of ComponentMarshaler.
- #marshal_dump ⇒ Object
- #marshal_load(a) ⇒ Object
Constructor Details
#initialize(type) ⇒ ComponentMarshaler
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/mayu/vdom/component_marshaler.rb', line 14 def initialize(type) @type = T.let( if Component === type klass = T.cast(type, T.class_of(Component::Base)) # TODO: Would be better to do something like # resources.resouce_for_type(klass) if resource = ( begin klass.__mayu_resource rescue StandardError nil end ) component = resource.path { component: } else { klass: klass } end else type end, T.untyped ) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
11 12 13 |
# File 'lib/mayu/vdom/component_marshaler.rb', line 11 def type @type end |
Instance Method Details
#marshal_dump ⇒ Object
43 44 45 |
# File 'lib/mayu/vdom/component_marshaler.rb', line 43 def marshal_dump @type end |
#marshal_load(a) ⇒ Object
48 49 50 |
# File 'lib/mayu/vdom/component_marshaler.rb', line 48 def marshal_load(a) @type = a end |