module Beefcake::Message::Dsl

Public Instance Methods

field(rule, name, type, fn, opts) click to toggle source
# File lib/beefcake.rb, line 68
def field(rule, name, type, fn, opts)
  if fields.include?(fn)
    raise DuplicateFieldNumber.new(fn, name)
  end
  fields[fn] = Field.new(rule, name, type, fn, opts)
  attr_accessor name
end
fields() click to toggle source
# File lib/beefcake.rb, line 76
def fields
  @fields ||= {}
end
optional(name, type, fn, opts={}) click to toggle source
# File lib/beefcake.rb, line 64
def optional(name, type, fn, opts={})
  field(:optional, name, type, fn, opts)
end
repeated(name, type, fn, opts={}) click to toggle source
# File lib/beefcake.rb, line 60
def repeated(name, type, fn, opts={})
  field(:repeated, name, type, fn, opts)
end
required(name, type, fn, opts={}) click to toggle source
# File lib/beefcake.rb, line 56
def required(name, type, fn, opts={})
  field(:required, name, type, fn, opts)
end