Class: MQ::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/mq/query.rb

Overview

Programmatic query builder for constructing mq queries in Ruby.

Examples:

Basic selector

MQ::Query.h2
# => ".h2"

Selector with filter

MQ::Query.h2.select { contains("Feature") }
# => '.h2 | select(contains("Feature"))'

Pipe operator

MQ::Query.h2 | MQ::Query.to_text
# => ".h2 | to_text()"

Attribute access

MQ::Query.link.url
# => ".link | .url"

Complex chain

MQ::Query.h2
  .select { contains("Section") & starts_with("##") }
  .to_text
# => '.h2 | select(contains("Section") and starts_with("##")) | to_text()'

Using with MQ.run

result = MQ.run(MQ::Query.h2.select { contains("Feature") }, content)

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expr = "") ⇒ Query

Returns a new instance of Query.



31
32
33
# File 'lib/mq/query.rb', line 31

def initialize(expr = "")
  @expr = expr.to_s
end

Class Method Details

.alignObject



437
# File 'lib/mq/query.rb', line 437

def align      = new(".align")

.altObject



430
# File 'lib/mq/query.rb', line 430

def alt        = new(".alt")

.blockquoteObject



358
# File 'lib/mq/query.rb', line 358

def blockquote = new(".blockquote")

.checkedObject



434
# File 'lib/mq/query.rb', line 434

def checked    = new(".checked")

.codeObject

Block element selectors



356
# File 'lib/mq/query.rb', line 356

def code       = new(".code")

.code_inlineObject

Inline element selectors



376
# File 'lib/mq/query.rb', line 376

def code_inline  = new(".code_inline")

.columnObject



435
# File 'lib/mq/query.rb', line 435

def column     = new(".column")

.definitionObject



370
# File 'lib/mq/query.rb', line 370

def definition = new(".definition")

.deleteObject



365
# File 'lib/mq/query.rb', line 365

def delete     = new(".delete")

.depthObject



431
# File 'lib/mq/query.rb', line 431

def depth      = new(".depth")

.doneObject



386
# File 'lib/mq/query.rb', line 386

def done       = new(".done")

.emphasisObject



364
# File 'lib/mq/query.rb', line 364

def emphasis   = new(".emphasis")

.fenceObject



428
# File 'lib/mq/query.rb', line 428

def fence      = new(".fence")

.footnoteObject



371
# File 'lib/mq/query.rb', line 371

def footnote   = new(".footnote")

.footnote_refObject



380
# File 'lib/mq/query.rb', line 380

def footnote_ref = new(".footnote_ref")

.headingObject

Generic heading (any level)



353
# File 'lib/mq/query.rb', line 353

def heading    = new(".heading")

.hrObject



359
# File 'lib/mq/query.rb', line 359

def hr         = new(".hr")

.htmlObject



369
# File 'lib/mq/query.rb', line 369

def html       = new(".html")

.imageObject



360
# File 'lib/mq/query.rb', line 360

def image      = new(".image")

.image_refObject



379
# File 'lib/mq/query.rb', line 379

def image_ref    = new(".image_ref")

.langObject



426
# File 'lib/mq/query.rb', line 426

def lang       = new(".lang")

.levelObject



432
# File 'lib/mq/query.rb', line 432

def level      = new(".level")

.line_breakObject



381
# File 'lib/mq/query.rb', line 381

def line_break   = new(".break")


361
# File 'lib/mq/query.rb', line 361

def link       = new(".link")


378
# File 'lib/mq/query.rb', line 378

def link_ref     = new(".link_ref")

.listObject

— List selector —



389
# File 'lib/mq/query.rb', line 389

def list       = new(".[]")

.list_at(n) ⇒ Object

List item at a specific index: .[n]



392
393
394
# File 'lib/mq/query.rb', line 392

def list_at(n)
  new(".[#{n}]")
end

.mathObject



366
# File 'lib/mq/query.rb', line 366

def math       = new(".math")

.math_inlineObject



377
# File 'lib/mq/query.rb', line 377

def math_inline  = new(".math_inline")

.mdx_flow_expressionObject



417
# File 'lib/mq/query.rb', line 417

def mdx_flow_expression   = new(".mdx_flow_expression")

.mdx_js_esmObject



418
# File 'lib/mq/query.rb', line 418

def mdx_js_esm            = new(".mdx_js_esm")

.mdx_jsx_flow_elementObject

— MDX selectors —



414
# File 'lib/mq/query.rb', line 414

def mdx_jsx_flow_element  = new(".mdx_jsx_flow_element")

.mdx_jsx_text_elementObject



416
# File 'lib/mq/query.rb', line 416

def mdx_jsx_text_element  = new(".mdx_jsx_text_element")

.mdx_text_expressionObject



415
# File 'lib/mq/query.rb', line 415

def mdx_text_expression   = new(".mdx_text_expression")

.metaObject



427
# File 'lib/mq/query.rb', line 427

def meta       = new(".meta")

.node_valuesObject



425
# File 'lib/mq/query.rb', line 425

def node_values = new(".values")

.orderedObject



433
# File 'lib/mq/query.rb', line 433

def ordered    = new(".ordered")

.paragraphObject



357
# File 'lib/mq/query.rb', line 357

def paragraph  = new(".p")

.property(key) ⇒ Object

Dict property selector: .“key”



440
441
442
# File 'lib/mq/query.rb', line 440

def property(key)
  new(".\"#{key}\"")
end

.recursiveObject

Recursive / deep selector (..)



421
# File 'lib/mq/query.rb', line 421

def recursive  = new("..")

.rowObject



436
# File 'lib/mq/query.rb', line 436

def row        = new(".row")

.select(filter = nil) { ... } ⇒ Query

Class-level select (no leading selector)

Parameters:

  • filter (Filter, String, nil) (defaults to: nil)

Yields:

Returns:



449
450
451
452
# File 'lib/mq/query.rb', line 449

def select(filter = nil, &block)
  filter_str = new.send(:resolve_filter, filter, &block)
  new("select(#{filter_str})")
end

.strongObject



363
# File 'lib/mq/query.rb', line 363

def strong     = new(".strong")

.tableObject



367
# File 'lib/mq/query.rb', line 367

def table      = new(".table")

.table_alignObject



368
# File 'lib/mq/query.rb', line 368

def table_align = new(".table_align")

.table_cell(r, c) ⇒ Object

A specific cell: .[row]



409
410
411
# File 'lib/mq/query.rb', line 409

def table_cell(r, c)
  new(".[#{r}][#{c}]")
end

.table_col(n) ⇒ Object

All cells in a specific column: .[][n]



404
405
406
# File 'lib/mq/query.rb', line 404

def table_col(n)
  new(".[][#{n}]")
end

.table_row(n) ⇒ Object

All cells in a specific row: .[n][]



399
400
401
# File 'lib/mq/query.rb', line 399

def table_row(n)
  new(".[#{n}][]")
end

.taskObject

Task list selectors



384
# File 'lib/mq/query.rb', line 384

def task       = new(".task")

.textObject



362
# File 'lib/mq/query.rb', line 362

def text       = new(".text")

.to_markdownObject



455
# File 'lib/mq/query.rb', line 455

def to_markdown = new("to_markdown()")

.to_textObject



454
# File 'lib/mq/query.rb', line 454

def to_text     = new("to_text()")

.todoObject



385
# File 'lib/mq/query.rb', line 385

def todo       = new(".todo")

.tomlObject



372
# File 'lib/mq/query.rb', line 372

def toml       = new(".toml")

.urlObject



429
# File 'lib/mq/query.rb', line 429

def url        = new(".url")

.valueObject

— Attribute selectors (as standalone starting points) —



424
# File 'lib/mq/query.rb', line 424

def value      = new(".value")

.yamlObject



373
# File 'lib/mq/query.rb', line 373

def yaml       = new(".yaml")

Instance Method Details

#absObject



164
# File 'lib/mq/query.rb', line 164

def abs            = pipe_with("abs()")

#add(other) ⇒ Object



77
78
79
# File 'lib/mq/query.rb', line 77

def add(other)
  pipe_with("add(#{other.inspect})")
end

#alignObject



249
# File 'lib/mq/query.rb', line 249

def align          = pipe_with(".align")

#altObject



238
# File 'lib/mq/query.rb', line 238

def alt            = pipe_with(".alt")

#attr(name) ⇒ Object



256
257
258
# File 'lib/mq/query.rb', line 256

def attr(name)
  pipe_with("attr(#{name.inspect})")
end

#base64Object



197
# File 'lib/mq/query.rb', line 197

def base64         = pipe_with("base64()")

#base64dObject



198
# File 'lib/mq/query.rb', line 198

def base64d        = pipe_with("base64d()")

#base64urlObject



199
# File 'lib/mq/query.rb', line 199

def base64url      = pipe_with("base64url()")

#base64urldObject



200
# File 'lib/mq/query.rb', line 200

def base64urld     = pipe_with("base64urld()")

#basenameObject



208
# File 'lib/mq/query.rb', line 208

def basename       = pipe_with("basename()")

#capture(pattern) ⇒ Object



160
161
162
# File 'lib/mq/query.rb', line 160

def capture(pattern)
  pipe_with("capture(#{pattern.inspect})")
end

#ceilObject



165
# File 'lib/mq/query.rb', line 165

def ceil           = pipe_with("ceil()")

#checkedObject



246
# File 'lib/mq/query.rb', line 246

def checked        = pipe_with(".checked")

#childrenObject



92
# File 'lib/mq/query.rb', line 92

def children       = pipe_with(".children")

#coalesce(default) ⇒ Object



193
194
195
# File 'lib/mq/query.rb', line 193

def coalesce(default)
  pipe_with("coalesce(#{default.inspect})")
end

#columnObject



247
# File 'lib/mq/query.rb', line 247

def column         = pipe_with(".column")

#compactObject



86
# File 'lib/mq/query.rb', line 86

def compact        = pipe_with("compact")

#debugObject



191
# File 'lib/mq/query.rb', line 191

def debug          = pipe_with("debug")

#del(value) ⇒ Object



126
127
128
# File 'lib/mq/query.rb', line 126

def del(value)
  pipe_with("del(#{value.inspect})")
end

#depthObject



242
# File 'lib/mq/query.rb', line 242

def depth          = pipe_with(".depth")

#dirnameObject



209
# File 'lib/mq/query.rb', line 209

def dirname        = pipe_with("dirname()")

#downcaseObject



141
# File 'lib/mq/query.rb', line 141

def downcase       = pipe_with("downcase()")

#emptyObject



83
# File 'lib/mq/query.rb', line 83

def empty          = pipe_with("is_empty()")

#entriesObject



91
# File 'lib/mq/query.rb', line 91

def entries        = pipe_with("entries")

#expObject



172
# File 'lib/mq/query.rb', line 172

def exp            = pipe_with("exp()")

#explodeObject



143
# File 'lib/mq/query.rb', line 143

def explode        = pipe_with("explode()")

#extnameObject



210
# File 'lib/mq/query.rb', line 210

def extname        = pipe_with("extname()")

#fenceObject



236
# File 'lib/mq/query.rb', line 236

def fence          = pipe_with(".fence")

#firstObject



81
# File 'lib/mq/query.rb', line 81

def first          = pipe_with("first")

#flattenObject



88
# File 'lib/mq/query.rb', line 88

def flatten        = pipe_with("flatten")

#floorObject



166
# File 'lib/mq/query.rb', line 166

def floor          = pipe_with("floor()")

#from_hexObject



204
# File 'lib/mq/query.rb', line 204

def from_hex       = pipe_with("from_hex()")

#get(key) ⇒ Object



217
218
219
# File 'lib/mq/query.rb', line 217

def get(key)
  pipe_with("get(#{key.inspect})")
end

#get_titleObject



264
# File 'lib/mq/query.rb', line 264

def get_title      = pipe_with("get_title")

#get_urlObject



265
# File 'lib/mq/query.rb', line 265

def get_url        = pipe_with("get_url")

#gsub(pattern, replacement) ⇒ Object



148
149
150
# File 'lib/mq/query.rb', line 148

def gsub(pattern, replacement)
  pipe_with("gsub(#{pattern.inspect}, #{replacement.inspect})")
end

#identObject



240
# File 'lib/mq/query.rb', line 240

def ident          = pipe_with(".ident")

#implodeObject



144
# File 'lib/mq/query.rb', line 144

def implode        = pipe_with("implode()")

#index(value) ⇒ Object



118
119
120
# File 'lib/mq/query.rb', line 118

def index(value)
  pipe_with("index(#{value.inspect})")
end

#insert(idx, val) ⇒ Object



130
131
132
# File 'lib/mq/query.rb', line 130

def insert(idx, val)
  pipe_with("insert(#{idx}, #{val.inspect})")
end

#internObject



146
# File 'lib/mq/query.rb', line 146

def intern         = pipe_with("intern()")

#is_nanObject



174
# File 'lib/mq/query.rb', line 174

def is_nan         = pipe_with("is_nan()")

#item_indexObject



244
# File 'lib/mq/query.rb', line 244

def item_index     = pipe_with(".index")

#join(separator) ⇒ Object



98
99
100
# File 'lib/mq/query.rb', line 98

def join(separator)
  pipe_with("join(#{separator.inspect})")
end

#keysObject



89
# File 'lib/mq/query.rb', line 89

def keys           = pipe_with("keys")

#labelObject



241
# File 'lib/mq/query.rb', line 241

def label          = pipe_with(".label")

#langObject



234
# File 'lib/mq/query.rb', line 234

def lang           = pipe_with(".lang")

#lastObject



82
# File 'lib/mq/query.rb', line 82

def last           = pipe_with("last")

#lenObject



74
# File 'lib/mq/query.rb', line 74

def len            = pipe_with("len()")

#lengthObject



73
# File 'lib/mq/query.rb', line 73

def length         = pipe_with("len()")

#levelObject



243
# File 'lib/mq/query.rb', line 243

def level          = pipe_with(".level")

#limit(n) ⇒ Object



106
107
108
# File 'lib/mq/query.rb', line 106

def limit(n)
  pipe_with("take(#{n})")
end

#lnObject



170
# File 'lib/mq/query.rb', line 170

def ln             = pipe_with("ln()")

#log10Object



171
# File 'lib/mq/query.rb', line 171

def log10          = pipe_with("log10()")

#ltrimObject



139
# File 'lib/mq/query.rb', line 139

def ltrim          = pipe_with("ltrim()")

#map(filter = nil) { ... } ⇒ Query

Append a map() transformation.

Parameters:

  • filter (Filter, String, nil) (defaults to: nil)

    filter expression (or use block)

Yields:

Returns:



58
59
60
61
# File 'lib/mq/query.rb', line 58

def map(filter = nil, &block)
  filter_str = resolve_filter(filter, &block)
  pipe_with("map(#{filter_str})")
end

#max(other) ⇒ Object



184
185
186
# File 'lib/mq/query.rb', line 184

def max(other)
  pipe_with("max(#{other})")
end

#md5Object



201
# File 'lib/mq/query.rb', line 201

def md5            = pipe_with("md5()")

#mdx_nameObject



250
# File 'lib/mq/query.rb', line 250

def mdx_name       = pipe_with(".name")

#metaObject



235
# File 'lib/mq/query.rb', line 235

def meta           = pipe_with(".meta")

#min(other) ⇒ Object



180
181
182
# File 'lib/mq/query.rb', line 180

def min(other)
  pipe_with("min(#{other})")
end

#negate_valObject



173
# File 'lib/mq/query.rb', line 173

def negate_val     = pipe_with("negate()")

#nth(n) ⇒ Object



102
103
104
# File 'lib/mq/query.rb', line 102

def nth(n)
  pipe_with("get(#{n})")
end

#orderedObject



245
# File 'lib/mq/query.rb', line 245

def ordered        = pipe_with(".ordered")

#path_join(other) ⇒ Object



213
214
215
# File 'lib/mq/query.rb', line 213

def path_join(other)
  pipe_with("path_join(#{other.inspect})")
end

#pow(n) ⇒ Object



176
177
178
# File 'lib/mq/query.rb', line 176

def pow(n)
  pipe_with("pow(#{n})")
end

#property(key) ⇒ Object

Access a dict property by key (generates .“key” selector)



226
227
228
# File 'lib/mq/query.rb', line 226

def property(key)
  pipe_with(".\"#{key}\"")
end

#range(n) ⇒ Object



110
111
112
# File 'lib/mq/query.rb', line 110

def range(n)
  pipe_with("range(#{n})")
end

#repeat(n) ⇒ Object



134
135
136
# File 'lib/mq/query.rb', line 134

def repeat(n)
  pipe_with("repeat(#{n})")
end

#replace(from, to) ⇒ Object



152
153
154
# File 'lib/mq/query.rb', line 152

def replace(from, to)
  pipe_with("replace(#{from.inspect}, #{to.inspect})")
end

#reverseObject



84
# File 'lib/mq/query.rb', line 84

def reverse        = pipe_with("reverse")

#rindex(value) ⇒ Object



122
123
124
# File 'lib/mq/query.rb', line 122

def rindex(value)
  pipe_with("rindex(#{value.inspect})")
end

#roundObject



167
# File 'lib/mq/query.rb', line 167

def round          = pipe_with("round()")

#rowObject



248
# File 'lib/mq/query.rb', line 248

def row            = pipe_with(".row")

#rtrimObject



140
# File 'lib/mq/query.rb', line 140

def rtrim          = pipe_with("rtrim()")

#select(filter = nil) { ... } ⇒ Query

Append a select() filter.

Parameters:

  • filter (Filter, String, nil) (defaults to: nil)

    filter expression (or use block)

Yields:

Returns:



48
49
50
51
# File 'lib/mq/query.rb', line 48

def select(filter = nil, &block)
  filter_str = resolve_filter(filter, &block)
  pipe_with("select(#{filter_str})")
end

#set(key, val) ⇒ Object



221
222
223
# File 'lib/mq/query.rb', line 221

def set(key, val)
  pipe_with("set(#{key.inspect}, #{val.inspect})")
end

#set_attr(name, val) ⇒ Object



260
261
262
# File 'lib/mq/query.rb', line 260

def set_attr(name, val)
  pipe_with("set_attr(#{name.inspect}, #{val.inspect})")
end

#set_check(val) ⇒ Object



267
268
269
# File 'lib/mq/query.rb', line 267

def set_check(val)
  pipe_with("set_check(#{val})")
end

#set_code_block_lang(lang) ⇒ Object



275
276
277
# File 'lib/mq/query.rb', line 275

def set_code_block_lang(lang)
  pipe_with("set_code_block_lang(#{lang.inspect})")
end

#set_list_ordered(val) ⇒ Object



279
280
281
# File 'lib/mq/query.rb', line 279

def set_list_ordered(val)
  pipe_with("set_list_ordered(#{val})")
end

#set_ref(ref) ⇒ Object



271
272
273
# File 'lib/mq/query.rb', line 271

def set_ref(ref)
  pipe_with("set_ref(#{ref.inspect})")
end

#sha256Object



202
# File 'lib/mq/query.rb', line 202

def sha256         = pipe_with("sha256()")

#sha512Object



203
# File 'lib/mq/query.rb', line 203

def sha512         = pipe_with("sha512()")

#slice(start, stop) ⇒ Object



114
115
116
# File 'lib/mq/query.rb', line 114

def slice(start, stop)
  pipe_with("slice(#{start}, #{stop})")
end

#sortObject



85
# File 'lib/mq/query.rb', line 85

def sort           = pipe_with("sort")

#split(separator) ⇒ Object



94
95
96
# File 'lib/mq/query.rb', line 94

def split(separator)
  pipe_with("split(#{separator.inspect})")
end

#sqrtObject



169
# File 'lib/mq/query.rb', line 169

def sqrt           = pipe_with("sqrt()")

#stemObject



211
# File 'lib/mq/query.rb', line 211

def stem           = pipe_with("stem()")

#test(pattern) ⇒ Object



156
157
158
# File 'lib/mq/query.rb', line 156

def test(pattern)
  pipe_with("test(#{pattern.inspect})")
end

#titleObject



239
# File 'lib/mq/query.rb', line 239

def title          = pipe_with(".title")

#to_arrayObject



69
# File 'lib/mq/query.rb', line 69

def to_array       = pipe_with("to_array()")

#to_bytesObject



70
# File 'lib/mq/query.rb', line 70

def to_bytes       = pipe_with("to_bytes()")

#to_code(lang = nil) ⇒ Object

Convert current value to a code block with the given language.



284
285
286
# File 'lib/mq/query.rb', line 284

def to_code(lang = nil)
  lang ? pipe_with("to_code(#{lang.inspect})") : pipe_with("to_code(null)")
end

#to_code_inlineObject



288
# File 'lib/mq/query.rb', line 288

def to_code_inline = pipe_with("to_code_inline()")

#to_emObject



320
# File 'lib/mq/query.rb', line 320

def to_em          = pipe_with("to_em()")

#to_h(depth) ⇒ Object

Convert current value to a heading of the given depth (1-6).



291
292
293
# File 'lib/mq/query.rb', line 291

def to_h(depth)
  pipe_with("to_h(#{depth})")
end

#to_hexObject



205
# File 'lib/mq/query.rb', line 205

def to_hex         = pipe_with("to_hex()")

#to_hex_strObject



206
# File 'lib/mq/query.rb', line 206

def to_hex_str     = pipe_with("to_hex()")

#to_hrObject



295
# File 'lib/mq/query.rb', line 295

def to_hr          = pipe_with("to_hr()")

#to_htmlObject



66
# File 'lib/mq/query.rb', line 66

def to_html        = pipe_with("to_html()")

#to_image(url, img_alt = nil, img_title = "") ⇒ Object

Create an image node. With all three args no auto-prepend occurs. With two args the current value becomes the alt text.



309
310
311
312
313
314
315
# File 'lib/mq/query.rb', line 309

def to_image(url, img_alt = nil, img_title = "")
  if img_alt
    pipe_with("to_image(#{url.inspect}, #{img_alt.inspect}, #{img_title.inspect})")
  else
    pipe_with("to_image(#{url.inspect}, #{img_title.inspect})")
  end
end

Create a link node. With all three args no auto-prepend occurs. With two args the current value becomes the link text.



299
300
301
302
303
304
305
# File 'lib/mq/query.rb', line 299

def to_link(url, text = nil, link_title = "")
  if text
    pipe_with("to_link(#{url.inspect}, #{text.inspect}, #{link_title.inspect})")
  else
    pipe_with("to_link(#{url.inspect}, #{link_title.inspect})")
  end
end

#to_markdownObject



64
# File 'lib/mq/query.rb', line 64

def to_markdown    = pipe_with("to_markdown()")

#to_markdown_stringObject



71
# File 'lib/mq/query.rb', line 71

def to_markdown_string = pipe_with("to_markdown_string()")

#to_mathObject



317
# File 'lib/mq/query.rb', line 317

def to_math        = pipe_with("to_math()")

#to_math_inlineObject



318
# File 'lib/mq/query.rb', line 318

def to_math_inline = pipe_with("to_math_inline()")

#to_md_list(list_level) ⇒ Object

Convert current value to a list item at the given nesting level.



324
325
326
# File 'lib/mq/query.rb', line 324

def to_md_list(list_level)
  pipe_with("to_md_list(#{list_level})")
end

#to_md_name(node_name) ⇒ Object

Convert current value to a markdown element with the given node name.



329
330
331
# File 'lib/mq/query.rb', line 329

def to_md_name(node_name)
  pipe_with("to_md_name(#{node_name.inspect})")
end

#to_md_table_cell(content, r, c) ⇒ Object

Build a table cell with content, row index, and column index.



339
340
341
# File 'lib/mq/query.rb', line 339

def to_md_table_cell(content, r, c)
  pipe_with("to_md_table_cell(#{content.inspect}, #{r}, #{c})")
end

#to_md_table_row(*cells) ⇒ Object

Build a table row from the given cell values.



334
335
336
# File 'lib/mq/query.rb', line 334

def to_md_table_row(*cells)
  pipe_with("to_md_table_row(#{cells.map(&:inspect).join(', ')})")
end

#to_md_textObject



321
# File 'lib/mq/query.rb', line 321

def to_md_text     = pipe_with("to_md_text()")

#to_mdxObject



65
# File 'lib/mq/query.rb', line 65

def to_mdx         = pipe_with("to_mdx()")

#to_numberObject



68
# File 'lib/mq/query.rb', line 68

def to_number      = pipe_with("to_number()")

#to_queryString Also known as: to_s

Returns the mq query string.

Returns:

  • (String)


345
# File 'lib/mq/query.rb', line 345

def to_query = @expr

#to_stringObject



67
# File 'lib/mq/query.rb', line 67

def to_string      = pipe_with("to_string()")

#to_strongObject



319
# File 'lib/mq/query.rb', line 319

def to_strong      = pipe_with("to_strong()")

#to_textObject



63
# File 'lib/mq/query.rb', line 63

def to_text        = pipe_with("to_text()")

#trimObject



138
# File 'lib/mq/query.rb', line 138

def trim           = pipe_with("trim()")

#truncObject



168
# File 'lib/mq/query.rb', line 168

def trunc          = pipe_with("trunc()")

#typeObject

— Type / logic —



190
# File 'lib/mq/query.rb', line 190

def type           = pipe_with("type")

#uniqObject



87
# File 'lib/mq/query.rb', line 87

def uniq           = pipe_with("uniq")

#upcaseObject



142
# File 'lib/mq/query.rb', line 142

def upcase         = pipe_with("upcase()")

#update(content) ⇒ Object



252
253
254
# File 'lib/mq/query.rb', line 252

def update(content)
  pipe_with("update(#{content.inspect})")
end

#urlObject



237
# File 'lib/mq/query.rb', line 237

def url            = pipe_with(".url")

#url_encodeObject



145
# File 'lib/mq/query.rb', line 145

def url_encode     = pipe_with("url_encode()")

#utf8bytelenObject



75
# File 'lib/mq/query.rb', line 75

def utf8bytelen    = pipe_with("utf8bytelen()")

#valueObject

Attribute selectors (access attributes of selected nodes) These generate attribute selector syntax (.url, .lang, etc.)



233
# File 'lib/mq/query.rb', line 233

def value          = pipe_with(".value")

#valuesObject



90
# File 'lib/mq/query.rb', line 90

def values         = pipe_with("values")

#|(other) ⇒ Query

Pipe two queries together using the | operator.

Parameters:

Returns:



39
40
41
# File 'lib/mq/query.rb', line 39

def |(other)
  self.class.new("#{@expr} | #{other.to_query}")
end