Class: Rufio::DslCommandLoader::CommandBuilder
- Inherits:
-
Object
- Object
- Rufio::DslCommandLoader::CommandBuilder
- Defined in:
- lib/rufio/dsl_command_loader.rb
Overview
コマンドビルダー
Instance Method Summary collapse
- #build ⇒ Object
- #description(desc) ⇒ Object
-
#initialize(name) ⇒ CommandBuilder
constructor
A new instance of CommandBuilder.
- #interpreter(interp) ⇒ Object
-
#method_missing(_method_name, *_args) ⇒ Object
未知のメソッドは無視.
- #respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean
-
#ruby(&block) ⇒ Object
inline Rubyブロックを定義.
- #script(path) ⇒ Object
-
#shell(command) ⇒ Object
inline シェルコマンドを定義.
Constructor Details
#initialize(name) ⇒ CommandBuilder
Returns a new instance of CommandBuilder.
124 125 126 127 128 129 130 131 |
# File 'lib/rufio/dsl_command_loader.rb', line 124 def initialize(name) @name = name @script = nil @description = "" @interpreter = nil @ruby_block = nil @shell_command = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(_method_name, *_args) ⇒ Object
未知のメソッドは無視
167 168 169 170 |
# File 'lib/rufio/dsl_command_loader.rb', line 167 def method_missing(_method_name, *_args) # DSL内で未知のメソッドが呼ばれた場合は無視 nil end |
Instance Method Details
#build ⇒ Object
155 156 157 158 159 160 161 162 163 164 |
# File 'lib/rufio/dsl_command_loader.rb', line 155 def build DslCommand.new( name: @name, script: @script, description: @description, interpreter: @interpreter, ruby_block: @ruby_block, shell_command: @shell_command ) end |
#description(desc) ⇒ Object
137 138 139 |
# File 'lib/rufio/dsl_command_loader.rb', line 137 def description(desc) @description = desc end |
#interpreter(interp) ⇒ Object
141 142 143 |
# File 'lib/rufio/dsl_command_loader.rb', line 141 def interpreter(interp) @interpreter = interp end |
#respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean
172 173 174 |
# File 'lib/rufio/dsl_command_loader.rb', line 172 def respond_to_missing?(_method_name, _include_private = false) true end |
#ruby(&block) ⇒ Object
inline Rubyブロックを定義
146 147 148 |
# File 'lib/rufio/dsl_command_loader.rb', line 146 def ruby(&block) @ruby_block = block end |
#script(path) ⇒ Object
133 134 135 |
# File 'lib/rufio/dsl_command_loader.rb', line 133 def script(path) @script = path end |
#shell(command) ⇒ Object
inline シェルコマンドを定義
151 152 153 |
# File 'lib/rufio/dsl_command_loader.rb', line 151 def shell(command) @shell_command = command end |