Class: Hiiro::Runners::Bin
- Inherits:
-
Object
- Object
- Hiiro::Runners::Bin
- Defined in:
- lib/hiiro.rb
Instance Attribute Summary collapse
-
#bin_name ⇒ Object
readonly
Returns the value of attribute bin_name.
-
#name ⇒ Object
(also: #full_name)
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #exact_match?(subcmd) ⇒ Boolean
-
#initialize(bin_name, path) ⇒ Bin
constructor
A new instance of Bin.
- #location ⇒ Object
- #match?(subcmd) ⇒ Boolean
- #params_string ⇒ Object
- #run(*args) ⇒ Object
- #subcommand_name ⇒ Object
- #type ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(bin_name, path) ⇒ Bin
Returns a new instance of Bin.
663 664 665 666 667 |
# File 'lib/hiiro.rb', line 663 def initialize(bin_name, path) @bin_name = bin_name @path = path @name = File.basename(path) end |
Instance Attribute Details
#bin_name ⇒ Object (readonly)
Returns the value of attribute bin_name.
660 661 662 |
# File 'lib/hiiro.rb', line 660 def bin_name @bin_name end |
#name ⇒ Object (readonly) Also known as: full_name
Returns the value of attribute name.
660 661 662 |
# File 'lib/hiiro.rb', line 660 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
660 661 662 |
# File 'lib/hiiro.rb', line 660 def path @path end |
Instance Method Details
#exact_match?(subcmd) ⇒ Boolean
673 674 675 |
# File 'lib/hiiro.rb', line 673 def exact_match?(subcmd) subcommand_name == subcmd.to_s end |
#location ⇒ Object
693 694 695 |
# File 'lib/hiiro.rb', line 693 def location path end |
#match?(subcmd) ⇒ Boolean
677 678 679 |
# File 'lib/hiiro.rb', line 677 def match?(subcmd) subcommand_name.start_with?(subcmd.to_s) end |
#params_string ⇒ Object
697 698 699 |
# File 'lib/hiiro.rb', line 697 def params_string nil end |
#run(*args) ⇒ Object
669 670 671 |
# File 'lib/hiiro.rb', line 669 def run(*args) system(path, *args) end |
#subcommand_name ⇒ Object
681 682 683 |
# File 'lib/hiiro.rb', line 681 def subcommand_name name.sub("#{bin_name}-", '') end |
#type ⇒ Object
689 690 691 |
# File 'lib/hiiro.rb', line 689 def type :bin end |
#values ⇒ Object
685 686 687 |
# File 'lib/hiiro.rb', line 685 def values {} end |