Method: BERT::Decode#read_complex_type

Defined in:
lib/bert/decode.rb

#read_complex_type(arity) ⇒ Object



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/bert/decode.rb', line 179

def read_complex_type(arity)
  case read_any_raw
    when :nil
      nil
    when :true
      true
    when :false
      false
    when :time
      Time.at(read_any_raw * 1_000_000 + read_any_raw, read_any_raw)
    when :regex
      source = read_any_raw
      opts = read_any_raw
      options = 0
      options |= Regexp::EXTENDED if opts.include?(:extended)
      options |= Regexp::IGNORECASE if opts.include?(:caseless)
      options |= Regexp::MULTILINE if opts.include?(:multiline)
      Regexp.new(source, options)
    when :dict
      read_dict
    else
      nil
  end
end