Class: Mack::JavaScript::Selector
- Includes:
- ViewHelpers::StringHelpers
- Defined in:
- lib/mack-javascript/helpers/script_generator.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
Instance Method Summary collapse
- #add(statement, options = {}) ⇒ Object
-
#initialize(generator, *sel) ⇒ Selector
constructor
A new instance of Selector.
- #to_s ⇒ Object
Methods included from ViewHelpers::StringHelpers
Constructor Details
#initialize(generator, *sel) ⇒ Selector
Returns a new instance of Selector.
153 154 155 156 157 158 |
# File 'lib/mack-javascript/helpers/script_generator.rb', line 153 def initialize(generator, *sel) @generator = generator @session_id = generator.session_id @selector = sel.first == 'this' ? 'this' : build_multiple_selector_string(sel) @generator << select end |
Instance Attribute Details
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
151 152 153 |
# File 'lib/mack-javascript/helpers/script_generator.rb', line 151 def session_id @session_id end |
Instance Method Details
#add(statement, options = {}) ⇒ Object
160 161 162 163 |
# File 'lib/mack-javascript/helpers/script_generator.rb', line 160 def add(statement, = {}) @generator.<<(".#{statement}", :add_to_last => true) self end |
#to_s ⇒ Object
165 166 167 |
# File 'lib/mack-javascript/helpers/script_generator.rb', line 165 def to_s @generator.to_s end |