Sha256: 751f06e922ced05d274986cfb8b01ef46f728f92246aed967318bb58fc93ff13
Contents?: true
Size: 677 Bytes
Versions: 2
Compression:
Stored size: 677 Bytes
Contents
grammar Sentence rule phrase token* { def to_s(env = {}) elements.collect { |x| x.to_s(env) }.join end } end rule token literal / variable end rule literal space / word / punctuation end rule variable "(" word ")" { def to_s(env = {}) arr = env[word.text_value] arr[rand(arr.length)] end } end rule space ' '+ { def to_s(env = {}) text_value end } end rule word [a-zA-Z0-9]+ { def to_s(env = {}) text_value end } end rule punctuation [,.!?] { def to_s(env = {}) text_value end } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
roflbot-0.0.3 | lib/roflbot/sentence.tt |
roflbot-0.0.1 | lib/roflbot/sentence.tt |