Module: Ripper::RubyBuilder::Hash

Included in:
Ripper::RubyBuilder
Defined in:
lib/ripper/ruby_builder/events/hash.rb

Instance Method Summary collapse

Instance Method Details

#on_assoc_new(key, value) ⇒ Object



18
19
20
# File 'lib/ripper/ruby_builder/events/hash.rb', line 18

def on_assoc_new(key, value)
  Ruby::Assoc.new(key, value, pop_token(:'@=>'))
end

#on_assoclist_from_args(args) ⇒ Object



10
11
12
# File 'lib/ripper/ruby_builder/events/hash.rb', line 10

def on_assoclist_from_args(args)
  args
end

#on_bare_assoc_hash(assocs) ⇒ Object



14
15
16
# File 'lib/ripper/ruby_builder/events/hash.rb', line 14

def on_bare_assoc_hash(assocs)
  Ruby::Hash.new(assocs)
end

#on_hash(assocs) ⇒ Object



4
5
6
7
8
# File 'lib/ripper/ruby_builder/events/hash.rb', line 4

def on_hash(assocs)
  rdelim = pop_token(:@rbrace)
  ldelim = pop_token(:@lbrace)
  Ruby::Hash.new(assocs, ldelim, rdelim)
end