Class: Bundler::FakeDsl

Inherits:
Object
  • Object
show all
Defined in:
lib/ext/bundler_fake_dsl.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ FakeDsl

Returns a new instance of FakeDsl.



4
5
6
7
8
# File 'lib/ext/bundler_fake_dsl.rb', line 4

def initialize(file)
  @groups = Hash.new{|h, k| h[k] = []}
  @gems = []
  instance_eval(file)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



36
37
# File 'lib/ext/bundler_fake_dsl.rb', line 36

def method_missing(*args)
end

Instance Method Details

#__gem_namesObject



18
19
20
# File 'lib/ext/bundler_fake_dsl.rb', line 18

def __gem_names
  __gems.map(&:first)
end

#__gemsObject



14
15
16
# File 'lib/ext/bundler_fake_dsl.rb', line 14

def __gems
  @gems
end

#__groupsObject



10
11
12
# File 'lib/ext/bundler_fake_dsl.rb', line 10

def __groups
  @groups
end

#gem(*args) ⇒ Object



31
32
33
34
# File 'lib/ext/bundler_fake_dsl.rb', line 31

def gem(*args)
  @gems << args
  @groups[@current_group] << args.first
end

#group(*group_names, &blk) ⇒ Object Also known as: groups



22
23
24
25
26
27
28
# File 'lib/ext/bundler_fake_dsl.rb', line 22

def group(*group_names, &blk)
  group_names.each do |name|
    @current_group = name.to_sym
    instance_eval(&blk)
    @current_group = nil
  end
end