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.
665 666 667 668 669 |
# File 'lib/hiiro.rb', line 665 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.
662 663 664 |
# File 'lib/hiiro.rb', line 662 def bin_name @bin_name end |
#name ⇒ Object (readonly) Also known as: full_name
Returns the value of attribute name.
662 663 664 |
# File 'lib/hiiro.rb', line 662 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
662 663 664 |
# File 'lib/hiiro.rb', line 662 def path @path end |
Instance Method Details
#exact_match?(subcmd) ⇒ Boolean
675 676 677 |
# File 'lib/hiiro.rb', line 675 def exact_match?(subcmd) subcommand_name == subcmd.to_s end |
#location ⇒ Object
695 696 697 |
# File 'lib/hiiro.rb', line 695 def location path end |
#match?(subcmd) ⇒ Boolean
679 680 681 |
# File 'lib/hiiro.rb', line 679 def match?(subcmd) subcommand_name.start_with?(subcmd.to_s) end |
#params_string ⇒ Object
699 700 701 |
# File 'lib/hiiro.rb', line 699 def params_string nil end |
#run(*args) ⇒ Object
671 672 673 |
# File 'lib/hiiro.rb', line 671 def run(*args) system(path, *args) end |
#subcommand_name ⇒ Object
683 684 685 |
# File 'lib/hiiro.rb', line 683 def subcommand_name name.sub("#{bin_name}-", '') end |
#type ⇒ Object
691 692 693 |
# File 'lib/hiiro.rb', line 691 def type :bin end |
#values ⇒ Object
687 688 689 |
# File 'lib/hiiro.rb', line 687 def values {} end |