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



34
35
# File 'lib/ext/bundler_fake_dsl.rb', line 34

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



29
30
31
32
# File 'lib/ext/bundler_fake_dsl.rb', line 29

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

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



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

def group(name, &blk)
  @current_group = name.to_sym
  instance_eval(&blk)
  @current_group = nil
end