Class: SyntaxTree::Database::TypeQuery
- Inherits:
-
Object
- Object
- SyntaxTree::Database::TypeQuery
- Defined in:
- lib/syntax_tree/database.rb
Overview
Query for a specific type of node.
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #each(database, &block) ⇒ Object
-
#initialize(type) ⇒ TypeQuery
constructor
A new instance of TypeQuery.
Constructor Details
#initialize(type) ⇒ TypeQuery
Returns a new instance of TypeQuery.
88 89 90 |
# File 'lib/syntax_tree/database.rb', line 88 def initialize(type) @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
86 87 88 |
# File 'lib/syntax_tree/database.rb', line 86 def type @type end |
Instance Method Details
#each(database, &block) ⇒ Object
92 93 94 95 |
# File 'lib/syntax_tree/database.rb', line 92 def each(database, &block) sql = "SELECT * FROM nodes WHERE type = ?" database.execute(sql, type).each(&block) end |