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.
77 78 79 |
# File 'lib/rexpro/message.rb', line 77 def type @type end |
Instance Method Details
#define_fields(hsh) ⇒ Object
92 93 94 95 96 97 98 |
# File 'lib/rexpro/message.rb', line 92 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
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/rexpro/message.rb', line 100 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
88 89 90 |
# File 'lib/rexpro/message.rb', line 88 def field_methods @field_methods ||= {} end |
#fields ⇒ Object
84 85 86 |
# File 'lib/rexpro/message.rb', line 84 def fields @fields ||= [] end |