Class: YeSQL::Statement
- Inherits:
-
Object
- Object
- YeSQL::Statement
- Extended by:
- Forwardable
- Includes:
- ActiveRecord::ConnectionAdapters::Quoting, Common::Adapter, Utils::Read
- Defined in:
- lib/yesql/statement.rb
Instance Method Summary collapse
- #bound ⇒ Object
-
#initialize(bindings = {}, file_path) ⇒ Statement
constructor
A new instance of Statement.
- #to_s ⇒ Object
- #view? ⇒ Boolean
Methods included from Utils::Read
Methods included from Common::Adapter
Constructor Details
#initialize(bindings = {}, file_path) ⇒ Statement
Returns a new instance of Statement.
20 21 22 23 |
# File 'lib/yesql/statement.rb', line 20 def initialize(bindings = {}, file_path) @bindings = bindings @file_path = file_path end |
Instance Method Details
#bound ⇒ Object
25 26 27 28 29 |
# File 'lib/yesql/statement.rb', line 25 def bound to_s.gsub(::YeSQL::BIND_REGEX) do |match| extract_bind_values(extractor[match[/(\w+)/].to_sym]) end end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/yesql/statement.rb', line 31 def to_s @to_s ||= statement(readable: true) end |
#view? ⇒ Boolean
35 36 37 |
# File 'lib/yesql/statement.rb', line 35 def view? to_s =~ /^create\s.*view\s/i end |