Module: Schemata::ClassMethods
- Defined in:
- lib/schemata/common/msgbase.rb
Instance Method Summary collapse
- #aux_schema ⇒ Object
- #mock ⇒ Object
- #mock_values ⇒ Object
- #previous_version ⇒ Object
- #schema ⇒ Object
- #version ⇒ Object
Instance Method Details
#aux_schema ⇒ Object
153 154 155 |
# File 'lib/schemata/common/msgbase.rb', line 153 def aux_schema return self::AUX_SCHEMA if defined?(self::AUX_SCHEMA) end |
#mock ⇒ Object
140 141 142 143 144 145 146 147 |
# File 'lib/schemata/common/msgbase.rb', line 140 def mock mock = {} mock_values.keys.each do |k| value = mock_values[k] mock[k] = value.respond_to?("call") ? value.call : value end self.new(mock) end |
#mock_values ⇒ Object
157 158 159 |
# File 'lib/schemata/common/msgbase.rb', line 157 def mock_values self::MOCK_VALUES end |
#previous_version ⇒ Object
166 167 168 169 170 171 |
# File 'lib/schemata/common/msgbase.rb', line 166 def previous_version _, component, msg_type, version = self.name.split("::") version = version[1..-1].to_i - 1 Schemata::const_get(component)::const_get(msg_type):: const_get("V#{version}") end |
#schema ⇒ Object
149 150 151 |
# File 'lib/schemata/common/msgbase.rb', line 149 def schema self::SCHEMA end |
#version ⇒ Object
161 162 163 164 |
# File 'lib/schemata/common/msgbase.rb', line 161 def version _, component, msg_type, version = self.name.split("::") version[1..-1].to_i end |