Class: Gem::Commands::SpecifyCommand::Proxy
- Inherits:
-
Object
- Object
- Gem::Commands::SpecifyCommand::Proxy
- Defined in:
- lib/gm/rubygems_plugin.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#ignored_files ⇒ Object
readonly
Returns the value of attribute ignored_files.
-
#test_files ⇒ Object
readonly
Returns the value of attribute test_files.
Instance Method Summary collapse
- #ignore_files(pattern = nil, &proc) ⇒ Object
- #include_files(*pattern, &proc) ⇒ Object
- #include_pattern(pattern, &inject) ⇒ Object
- #include_test_files(*pattern, &proc) ⇒ Object
-
#initialize(target) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(m, *args, &block) ⇒ Object
Constructor Details
#initialize(target) ⇒ Proxy
Returns a new instance of Proxy.
77 78 79 80 81 82 |
# File 'lib/gm/rubygems_plugin.rb', line 77 def initialize(target) @target = target @ignored_files = [] @files = [] @test_files = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
106 107 108 109 110 111 112 |
# File 'lib/gm/rubygems_plugin.rb', line 106 def method_missing(m,*args,&block) m = m.to_s if args.size == 1 && m[-1,1] != '=' && @target.respond_to?("#{m}=") m = "#{m}=" end @target.send(m,*args,&block) end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
76 77 78 |
# File 'lib/gm/rubygems_plugin.rb', line 76 def files @files end |
#ignored_files ⇒ Object (readonly)
Returns the value of attribute ignored_files.
76 77 78 |
# File 'lib/gm/rubygems_plugin.rb', line 76 def ignored_files @ignored_files end |
#test_files ⇒ Object (readonly)
Returns the value of attribute test_files.
76 77 78 |
# File 'lib/gm/rubygems_plugin.rb', line 76 def test_files @test_files end |
Instance Method Details
#ignore_files(pattern = nil, &proc) ⇒ Object
83 84 85 |
# File 'lib/gm/rubygems_plugin.rb', line 83 def ignore_files(pattern=nil, &proc) @ignored_files.push(pattern || proc) end |
#include_files(*pattern, &proc) ⇒ Object
86 87 88 89 90 91 |
# File 'lib/gm/rubygems_plugin.rb', line 86 def include_files(*pattern, &proc) pattern.push(proc) pattern = pattern.flatten.compact.uniq pattern = pattern.first if pattern.size == 1 include_pattern(pattern) { |files| @files.concat(files) } end |
#include_pattern(pattern, &inject) ⇒ Object
98 99 100 101 102 103 104 105 |
# File 'lib/gm/rubygems_plugin.rb', line 98 def include_pattern(pattern, &inject) case pattern when Proc then include_pattern(pattern.call, &inject) when Array then pattern.each { |p| include_pattern(p, &inject) } when String then inject.call(Dir.glob(pattern).compact.uniq) when NilClass then # nothing end end |
#include_test_files(*pattern, &proc) ⇒ Object
92 93 94 95 96 97 |
# File 'lib/gm/rubygems_plugin.rb', line 92 def include_test_files(*pattern, &proc) pattern.push(proc) pattern = pattern.flatten.compact.uniq pattern = pattern.first if pattern.size == 1 include_pattern(pattern) { |files| @test_files.concat(files) } end |