Class: MilkTea::Types::Event
- Defined in:
- lib/milk_tea/core/types/types.rb
Instance Attribute Summary collapse
-
#capacity ⇒ Object
readonly
Returns the value of attribute capacity.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#linkage_name ⇒ Object
readonly
Returns the value of attribute linkage_name.
-
#module_name ⇒ Object
readonly
Returns the value of attribute module_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owner_type_name ⇒ Object
readonly
Returns the value of attribute owner_type_name.
-
#payload_type ⇒ Object
readonly
Returns the value of attribute payload_type.
-
#visibility ⇒ Object
readonly
Returns the value of attribute visibility.
Instance Method Summary collapse
- #children ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #hidden_field_name ⇒ Object
-
#initialize(name, capacity:, payload_type: nil, module_name: nil, visibility: :private, owner_type_name: nil) ⇒ Event
constructor
A new instance of Event.
- #to_s ⇒ Object
Methods inherited from Base
#accept, #bitwise?, #boolean?, #field_c_name, #float?, #integer?, #numeric?, #sendable?, #void?
Constructor Details
#initialize(name, capacity:, payload_type: nil, module_name: nil, visibility: :private, owner_type_name: nil) ⇒ Event
Returns a new instance of Event.
741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 |
# File 'lib/milk_tea/core/types/types.rb', line 741 def initialize(name, capacity:, payload_type: nil, module_name: nil, visibility: :private, owner_type_name: nil) @name = name @capacity = capacity @payload_type = payload_type @module_name = module_name @visibility = visibility @owner_type_name = owner_type_name @linkage_name = begin parts = ["mt_event"] parts << module_name&.gsub(/[^A-Za-z0-9_]+/, "_") parts << owner_type_name&.gsub(/[^A-Za-z0-9_]+/, "_") parts << name.gsub(/[^A-Za-z0-9_]+/, "_") parts << payload_type.to_s.gsub(/[^A-Za-z0-9_]+/, "_") if payload_type parts << capacity.to_s parts.compact.reject(&:empty?).join("_") end @hash = [self.class, name, capacity, payload_type, module_name, visibility, owner_type_name].hash freeze end |
Instance Attribute Details
#capacity ⇒ Object (readonly)
Returns the value of attribute capacity.
739 740 741 |
# File 'lib/milk_tea/core/types/types.rb', line 739 def capacity @capacity end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
773 774 775 |
# File 'lib/milk_tea/core/types/types.rb', line 773 def hash @hash end |
#linkage_name ⇒ Object (readonly)
Returns the value of attribute linkage_name.
739 740 741 |
# File 'lib/milk_tea/core/types/types.rb', line 739 def linkage_name @linkage_name end |
#module_name ⇒ Object (readonly)
Returns the value of attribute module_name.
739 740 741 |
# File 'lib/milk_tea/core/types/types.rb', line 739 def module_name @module_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
739 740 741 |
# File 'lib/milk_tea/core/types/types.rb', line 739 def name @name end |
#owner_type_name ⇒ Object (readonly)
Returns the value of attribute owner_type_name.
739 740 741 |
# File 'lib/milk_tea/core/types/types.rb', line 739 def owner_type_name @owner_type_name end |
#payload_type ⇒ Object (readonly)
Returns the value of attribute payload_type.
739 740 741 |
# File 'lib/milk_tea/core/types/types.rb', line 739 def payload_type @payload_type end |
#visibility ⇒ Object (readonly)
Returns the value of attribute visibility.
739 740 741 |
# File 'lib/milk_tea/core/types/types.rb', line 739 def visibility @visibility end |
Instance Method Details
#children ⇒ Object
785 786 787 |
# File 'lib/milk_tea/core/types/types.rb', line 785 def children [payload_type].compact end |
#eql?(other) ⇒ Boolean Also known as: ==
761 762 763 764 765 766 767 768 769 |
# File 'lib/milk_tea/core/types/types.rb', line 761 def eql?(other) other.is_a?(Event) && other.name == name && other.capacity == capacity && other.payload_type == payload_type && other.module_name == module_name && other.visibility == visibility && other.owner_type_name == owner_type_name end |
#hidden_field_name ⇒ Object
775 776 777 |
# File 'lib/milk_tea/core/types/types.rb', line 775 def hidden_field_name "__event_#{name}" end |
#to_s ⇒ Object
779 780 781 782 783 |
# File 'lib/milk_tea/core/types/types.rb', line 779 def to_s label = owner_type_name ? "#{owner_type_name}.#{name}" : name payload = payload_type ? "(#{payload_type})" : "" "event #{label}[#{capacity}]#{payload}" end |