Module: Rexpro::Message::Base::ClassMethods
- Defined in:
- lib/rexpro/message.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #define_fields(hsh) ⇒ Object
- #define_meta_fields(*names) ⇒ Object
- #field_methods ⇒ Object
- #fields ⇒ Object
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
79 80 81 |
# File 'lib/rexpro/message.rb', line 79 def type @type end |
Instance Method Details
#define_fields(hsh) ⇒ Object
94 95 96 97 98 99 100 |
# File 'lib/rexpro/message.rb', line 94 def define_fields(hsh) hsh.each do |name, method| fields << name field_methods[name] = method attr_accessor(name) end end |
#define_meta_fields(*names) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/rexpro/message.rb', line 102 def (*names) names.each do |name| # RexPro uses mixedCase keys in meta name_parts = name.to_s.split('_') name_parts[1..-1].each(&:capitalize!) rexpro_name = name_parts.join define_method(name) { [rexpro_name] } define_method("#{name}=") { |value| [rexpro_name] = value } end end |
#field_methods ⇒ Object
90 91 92 |
# File 'lib/rexpro/message.rb', line 90 def field_methods @field_methods ||= {} end |
#fields ⇒ Object
86 87 88 |
# File 'lib/rexpro/message.rb', line 86 def fields @fields ||= [] end |