Module: Keyword::ClassMethods

Included in:
Heading, Point, Section
Defined in:
lib/diml/elements/keyword.rb

Instance Method Summary collapse

Instance Method Details

#def_token(value) ⇒ Object



22
23
24
# File 'lib/diml/elements/keyword.rb', line 22

def def_token(value)
  define_singleton_method("token") { value }
end

#try(v) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/diml/elements/keyword.rb', line 26

def try(v)
  # TODO: add more intelligence to this
  # i.e. not just starting with
  return false if v.nil?

  v.start_with?(token)
end