I'm going through the capistrano handbook
https://github.com/leehambley/capistrano-handbook/blob/master/index.markdown
And see the keyword "set" appear
set :deploy_via, :remote_cache
Does set in this example set the symbol :deploy_via
to :remote_cache
?
That's not a keyword in standard Ruby. It's an example of an element in a Domain Specific Language (DSL).
Basically, a DSL allows you to work at a higher level of abstraction by providing more targeted constructs than a general-purpose language like Ruby. The "set" here is an example of this. It's probably just a function in Ruby that you're actually calling, but when you use it, it feels more like a language construct in its own right. Ruby is particularly good at writing DSLs
As for what this does in Capistrano, I have no idea, I've never used Capistrano. :)
set
is not ruby keyword in capistrano
command
from capistrano source
def set(key, value)
@properties[key] = value
end
set
has no particular meaning in Ruby. In fact, it's not a Ruby keyword, it's a Capistrano command, part of the Capistrano DSL.
Technically speaking, it's a Ruby method. You can see the method definition.
def set(key, value)
config[key] = value
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With