Class: ViewSpec::ExecutableString
- Inherits:
-
Object
- Object
- ViewSpec::ExecutableString
- Defined in:
- lib/view_spec/executable_string.rb
Instance Attribute Summary collapse
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
Instance Method Summary collapse
-
#initialize(str, lang = nil) ⇒ ExecutableString
constructor
A new instance of ExecutableString.
- #raw ⇒ Object
- #source ⇒ Object
- #to_proc ⇒ Object
Constructor Details
#initialize(str, lang = nil) ⇒ ExecutableString
Returns a new instance of ExecutableString.
5 6 7 8 9 |
# File 'lib/view_spec/executable_string.rb', line 5 def initialize(str, lang = nil) @str = str @executable = lambda { render inline: str, type: lang || :erb } @lang = lang end |
Instance Attribute Details
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
3 4 5 |
# File 'lib/view_spec/executable_string.rb', line 3 def lang @lang end |
Instance Method Details
#raw ⇒ Object
19 20 21 |
# File 'lib/view_spec/executable_string.rb', line 19 def raw @str end |
#source ⇒ Object
11 12 13 |
# File 'lib/view_spec/executable_string.rb', line 11 def source CGI.unescapeHTML @str.strip_heredoc.strip end |
#to_proc ⇒ Object
15 16 17 |
# File 'lib/view_spec/executable_string.rb', line 15 def to_proc @executable end |