Rootly 내장

find

  • find: arg1, 'arg2'

    • arg1. 문자열

    • arg2. 문자열

JS
// Pretending object is the following object [{"id": "apple"}, {"id": "banana"}]
{{ object | find: 'id', 'banana' }}
// Output
// {"id": "banana"}

get

  • get: 'arg'

    • arg. 문자열
JS
// Pretending object is the following object {"id": "id", "incident": {"title": "Something is on fire!"}}
{{ object | get: 'incident.title' }}
// Output
// Something is on fire!

smart_date

JS


{{ 'now' | smart\_date: 'tomorrow' }}
// Output
// 2023-06-29 12:00:00 -0700

slice

  • slice: '\*arg'

    • arg. 문자열

    • … 필요한 만큼의 인수

JS


// Pretending object is the following object {"key": "hello", "value": "world", "foo": "bar"}

{{ object | slice: 'key' }}

// Output
// {"key": "hello"}

{{ object | slice: 'key', 'foo' }}

// Output
// {"key": "hello", "foo": "bar"}

flatten

  • flatten
JS

// Pretending object is the following object \["1", "2", \["3"\]\]
{{ object | flatten }}
// Output
// \["1","2","3"\]

to_values

  • to\_values: 'key'

    • key는 선택사항입니다
JS

// Pretending object is the following object {"key": "hello", "value": "world"}
{{ object | to\_values }}

// Output
// \[{"value":"world"}\]

{{ object | to\_values: 'key' }}

// Output
// \[{"value":"hello"}\]

to_json

  • to\_json
JS
// Pretending object is the following object [{"key": "hello", "value": "world"}]
{{ object | to_json }}
// Output
// [{"key":"hello","value":"world"}]

to_iso8601

  • to\_iso8601
JS
// Pretending object is the following datetime
{{ object | to_iso8601 }}
// Output
// 2023-06-29T12:00:00-07:00

distance_of_time_in_words

  • distance\_of\_time\_in\_words: 'arg', 'precise'

    • arg. 문자열 (선택사항)

    • precise. 문자열 (선택사항)

JS
{{ 3720 | distance_of_time_in_words }}
// Output
// about 1 hour
{{ 3720 | distance_of_time_in_words: 0, 'precise' }}
// Output
// 1 hour and 2 minutes
{{ 'May 1, 2020' | distance_of_time_in_words: 'May 31, 2020' }}
// Output
// about 1 month
{{ 'May 1, 2020' | distance_of_time_in_words: 'May 31, 2020', 'precise' }}
// Output
// 4 weeks and 2 days

distance_of_time_in_words_to_now

  • distance\_of\_time\_in\_words\_to\_now: 'precise'

    • precise. 문자열 (선택사항)
JS
{{ 'May 1, 2020' | distance_of_time_in_words_to_now }}
// Output
// over 2 years
{{ 'May 1, 2020' | distance_of_time_in_words_to_now: 'precise' }}
// Output
// 2 years and 7 months

in_time_zone

  • in\_time\_zone: 'time\_zone'

JS

{{ now | in\_time\_zone: 'Europe/London' | date: '%Y-%m-%d %H:%M %Z' }}

에 나열된 모든 시간대Timezones 에서 사용 가능한 값 참조

to_table

  • to\_table: 'table\_type', 'title', 'time\_zone', 'format'

    • table\_type는 events 또는 action_items 중 하나입니다

    • time\_zone. Timezones

    • format에 나열된 모든 시간대 는 ascii, markdown, html, atlassian_markdown 중 하나일 수 있습니다

JS

{{ incident.events | to\_table: 'events', 'Hello world', 'America/Los\_Angeles', 'markdown' }}

regex_replace

전역 대체

  • regex\_replace: 'regex', 'replacement'

    • regexp 루비 정규 표현식

    • replacement 루비 정규 표현식

JS
{{ 'foo bar 123 456' | regex_replace: '\d+', 'baz' }}
// Output
// foo bar baz baz

regex_replace_first

첫 번째 일치 교체

  • regex\_replace\_first: 'regex', 'replacement'

    • regexpRuby 정규 표현식

    • replacementRuby 정규 표현식

JS
{{ 'foo bar 123 456' | regex_replace: '\d+', 'baz' }}
// Output
// foo bar baz 456

regex_remove

전역 일치 제거

  • regex\_remove: 'regex'

    • regexpRuby 정규 표현식
JS
{{ 'foo bar 123 456' | regex_remove: '\d+' }}
// Output
// foo bar

regex_remove_first

첫 번째 일치 제거

  • regex\_remove\_first: 'regex'

    • regexpRuby 정규 표현식
JS
{{ 'foo bar 123 456' | regex_remove_first: '\d+' }}
// Output
// foo bar  456

dasherize

  • dasherize
JS
{{ 'hello_world' | dasherize }}
// Output
// hello-world

parameterize

  • parameterize

    • separator(기본값 ’-‘)
JS
{{ 'Hello World' | parameterize }}
// Output
// hello-world
{{ 'Hello World' | parameterize: '_' }}
// Output
// hello_world

camelize

  • camelize
JS
{{ 'hello world' | camelize }}
// Output
// Hello world

titleize

  • titleize
JS

{{ 'hello world' | titleize }}
// Output
// Hello World

singularize

  • singularize
JS
{{ 'cars' | singularize }}
// Output
// car

pluralize

  • pluralize
JS
{{ 'car' | pluralize }}
// Output
// cars

humanize

  • humanize
JS
{{ '0' | humanize }}
// Output
// No
{{ '1' | humanize }}
// Output
// Yes
{{ 'incident_management' | humanize }}
// Output
// Incident Management

shuffle

  • shuffle
JS
{{ '123456789' | shuffle }}
// Output
// 973426581

Liquid 내장

shortener

  • shortener
JS
{{ 'https://rootly.com/account/incidents/123456' | shortener }}
// Output
// https://root.ly/1234