Module: Qig
- Defined in:
- lib/qig.rb,
lib/qig/version.rb,
lib/qig/qiggable.rb
Overview
Combining the powers of dig and jq.
Qig is dig extended with jq's value iteration [] operator.
Defined Under Namespace
Modules: Qiggable
Constant Summary collapse
- VERSION =
'0.4.0'
Class Method Summary collapse
-
.qig(subject, *path) ⇒ Object+
The value(s) of
subjectlocated atpath. -
.values(arrayish) ⇒ Array, Object
"values" as in jq's "value iterator".
Class Method Details
.qig(subject, *path) ⇒ Object+
Returns the value(s) of subject located at path.
15 16 17 |
# File 'lib/qig.rb', line 15 def qig(subject, *path) unit_qig(subject, *path) end |
.values(arrayish) ⇒ Array, Object
"values" as in jq's "value iterator".
Coerce to array by taking the .values. Intuitively, get all possible values of arrayish[x].
25 26 27 |
# File 'lib/qig.rb', line 25 def values(arrayish) arrayish.respond_to?(:values) ? arrayish.values : arrayish end |