-
-
Save toretore/32c70bf8b8b0271571cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(cat vars.erb template.erb) | ruby t.rb | |
FOO = BAR | |
BAR = default bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'erb' | |
class Context | |
def self.const_missing(name) | |
nil | |
end | |
def binding | |
super | |
end | |
end | |
print ERB.new(STDIN.read).result(Context.new.binding) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FOO = <%= FOO || 'default foo' %> | |
BAR = <%= BAR || 'default bar' %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
FOO="BAR" | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment