Module: Micro::Struct
- Extended by:
- Struct
- Included in:
- Struct
- Defined in:
- lib/micro/struct.rb,
lib/micro/struct/factory.rb,
lib/micro/struct/version.rb,
lib/micro/struct/features.rb,
lib/micro/struct/factory/members.rb,
lib/micro/struct/normalize_names.rb,
lib/micro/struct/factory/create_struct.rb
Overview
typed: true frozen_string_literal: true
Constant Summary collapse
- VERSION =
'1.1.0'
Instance Method Summary collapse
- #immutable(with: EMPTY_ARRAY) ⇒ Object
- #instance(**members, &block) ⇒ Object
- #new(*members, required: nil, optional: nil, &block) ⇒ Object
- #readonly(with: EMPTY_ARRAY) ⇒ Object
- #with(*feature_names) ⇒ Object (also: #[])
Instance Method Details
#immutable(with: EMPTY_ARRAY) ⇒ Object
86 87 88 |
# File 'lib/micro/struct.rb', line 86 def immutable(with: EMPTY_ARRAY) factory(with, IMMUTABLE) end |
#instance(**members, &block) ⇒ Object
74 75 76 |
# File 'lib/micro/struct.rb', line 74 def instance(**members, &block) with.instance(**members, &block) end |
#new(*members, required: nil, optional: nil, &block) ⇒ Object
70 71 72 |
# File 'lib/micro/struct.rb', line 70 def new(*members, required: nil, optional: nil, &block) with.__create__(members, required, optional, block) end |
#readonly(with: EMPTY_ARRAY) ⇒ Object
82 83 84 |
# File 'lib/micro/struct.rb', line 82 def readonly(with: EMPTY_ARRAY) factory(with, READONLY) end |
#with(*feature_names) ⇒ Object Also known as: []
64 65 66 |
# File 'lib/micro/struct.rb', line 64 def with(*feature_names) factory(feature_names) end |