Class: Envandle::Elements::Gem

Inherits:
Envandle::Element show all
Defined in:
lib/envandle/elements/gem.rb

Instance Method Summary collapse

Methods inherited from Envandle::Element

#<<, #children, #children_by_type, #draw, #dsl, #gemfile, #groups_or_default, #history_argsets, #parse_string_option, #parse_string_value, #send_to_bundler, #send_to_history

Constructor Details

#initializeGem

Returns a new instance of Gem.



4
5
6
7
# File 'lib/envandle/elements/gem.rb', line 4

def initialize(*)
  super
  @name = parse_string_value(@args.args[0].to_s, "gem name")
end

Instance Method Details

#bundler_argsetsObject



23
24
25
26
27
# File 'lib/envandle/elements/gem.rb', line 23

def bundler_argsets
  @bundler_argsets ||= [].tap do |a|
    extract_bundler_argsets a, {}
  end
end

#extract_bundler_argsets(a, cache) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/envandle/elements/gem.rb', line 13

def extract_bundler_argsets(a, cache)
  found = false
  @args.contextual_groups.each do |group|
    if gemfile.references.extract_bundler_argsets(@args, group, @name, a, cache)
      found = true
    end
  end
  a << Argset.new(:gem, *@args.args_and_options) unless found
end

#typeObject



9
10
11
# File 'lib/envandle/elements/gem.rb', line 9

def type
  :gem
end