Class: GemInfo::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_info/runner.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, *args) ⇒ Runner

Returns a new instance of Runner.



7
8
9
10
11
# File 'lib/gem_info/runner.rb', line 7

def initialize(options={}, *args)
  @options = options
  @args = args
  @output = STDOUT
end

Class Attribute Details

.expansionsObject (readonly)

Returns the value of attribute expansions.



99
100
101
# File 'lib/gem_info/runner.rb', line 99

def expansions
  @expansions
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



13
14
15
# File 'lib/gem_info/runner.rb', line 13

def args
  @args
end

#optionsObject

Returns the value of attribute options.



13
14
15
# File 'lib/gem_info/runner.rb', line 13

def options
  @options
end

#outputObject

Returns the value of attribute output.



13
14
15
# File 'lib/gem_info/runner.rb', line 13

def output
  @output
end

Class Method Details

.expand(token, &expansion) ⇒ Object



95
96
97
98
# File 'lib/gem_info/runner.rb', line 95

def expand(token, &expansion)
  @expansions ||= {}
  expansions[token] = expansion
end

.run(options, *args) ⇒ Object



3
4
5
# File 'lib/gem_info/runner.rb', line 3

def self.run(options, *args)
  Runner.new(options, *args).run
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
# File 'lib/gem_info/runner.rb', line 15

def run
  parse_args
  parse_options
  matcher = FuzzyMatcher.new(@name, @version)
  specs = matcher.matches(installed_specs)
  validate_exactly_one(specs)
  output_formatted(specs)
end