Sha256: 40fa974671ef8f12def5df662c1b9d06c772ce382de41b0500e7703c4db2333f

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

Feature: core_ext

  jr introduce some extended method for basic objects

  Scenario: attribute reader
    Given a file named "input.json" with:
    """
    {"name":"foo"}
    {"name":"bar"}
    {"name":"baz"}
    """
    When I run `jr 'map(&:name)' input.json`
    Then the output should contain exactly:
    """
    "foo"
    "bar"
    "baz"

    """

  Scenario: attribute checker
    Given a file named "input.json" with:
    """
    {"ua":"Chrome"}
    {"ua":"Safari","is_crawler":false}
    {"ua":"Googlebot","is_crawler":true}
    """
    When I run `jr 'select(&:is_crawler?)' input.json`
    Then the output should contain exactly:
    """
    {
      "ua": "Googlebot",
      "is_crawler": true
    }

  """

  Scenario: unwrap Array and Hash
    Given a file named "input.json" with:
    """
    ["a","b",["c"]]
    {"a":"A","b":"B","c":{"cc":"CC"}}
    """
    When I run `jr 'unwrap' input.json`
    Then the output should contain exactly:
    """
    "a"
    "b"
    [
      "c"
    ]
    "A"
    "B"
    {
      "cc": "CC"
    }

    """

  Scenario: number of JSON
    Given a file named "input.json" with:
    """
    {"name":"foo"}
    {"name":"bar"}
    {"name":"baz"}
    """
    When I run `jr 'size' input.json`
    Then the output should contain exactly:
    """
    3

    """

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jr-cli-0.6.0 features/core_ext.feature
jr-cli-0.5.1 features/core_ext.feature
jr-cli-0.5.0 features/core_ext.feature
jr-cli-0.4.0 features/core_ext.feature
jr-cli-0.3.1 features/core_ext.feature
jr-cli-0.3.0 features/core_ext.feature
jr-cli-0.2.0 features/core_ext.feature