Class: MatchData

Inherits:
Object
  • Object
show all
Defined in:
lib/Olib.rb,
lib/Olib/character/group.rb

Instance Method Summary collapse

Instance Method Details

#to_hashObject



16
17
18
19
20
# File 'lib/Olib.rb', line 16

def to_hash
  Hash[self.names.zip(self.captures.map(&:strip).map do |capture|  
    if capture.is_i? then capture.to_i else capture end
  end)]
end

#to_structObject



12
13
14
# File 'lib/Olib.rb', line 12

def to_struct
  OpenStruct.new to_hash
end