Sha256: d1cbdb2947e6d2e1877698c110347c1fe2a1a0d941e4480e55aa8e6fdad9ebc2
Contents?: true
Size: 678 Bytes
Versions: 3
Compression:
Stored size: 678 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
roflbot-0.0.6 | lib/roflbot/sentence.tt |
roflbot-0.0.5 | lib/roflbot/sentence.tt |
roflbot-0.0.4 | lib/roflbot/sentence.tt |