Class: Hiiro::Runners::Bin

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bin_name, path) ⇒ Bin

Returns a new instance of Bin.



664
665
666
667
668
# File 'lib/hiiro.rb', line 664

def initialize(bin_name, path)
  @bin_name = bin_name
  @path = path
  @name = File.basename(path)
end

Instance Attribute Details

#bin_nameObject (readonly)

Returns the value of attribute bin_name.



661
662
663
# File 'lib/hiiro.rb', line 661

def bin_name
  @bin_name
end

#nameObject (readonly) Also known as: full_name

Returns the value of attribute name.



661
662
663
# File 'lib/hiiro.rb', line 661

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



661
662
663
# File 'lib/hiiro.rb', line 661

def path
  @path
end

Instance Method Details

#exact_match?(subcmd) ⇒ Boolean

Returns:

  • (Boolean)


674
675
676
# File 'lib/hiiro.rb', line 674

def exact_match?(subcmd)
  subcommand_name == subcmd.to_s
end

#locationObject



694
695
696
# File 'lib/hiiro.rb', line 694

def location
  path
end

#match?(subcmd) ⇒ Boolean

Returns:

  • (Boolean)


678
679
680
# File 'lib/hiiro.rb', line 678

def match?(subcmd)
  subcommand_name.start_with?(subcmd.to_s)
end

#params_stringObject



698
699
700
# File 'lib/hiiro.rb', line 698

def params_string
  nil
end

#run(*args) ⇒ Object



670
671
672
# File 'lib/hiiro.rb', line 670

def run(*args)
  system(path, *args)
end

#subcommand_nameObject



682
683
684
# File 'lib/hiiro.rb', line 682

def subcommand_name
  name.sub("#{bin_name}-", '')
end

#typeObject



690
691
692
# File 'lib/hiiro.rb', line 690

def type
  :bin
end

#valuesObject



686
687
688
# File 'lib/hiiro.rb', line 686

def values
  {}
end