Class: Beefcake::Message::Field

Inherits:
Struct
  • Object
show all
Defined in:
lib/beefcake.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fnObject

Returns the value of attribute fn

Returns:

  • (Object)

    the current value of fn


32
33
34
# File 'lib/beefcake.rb', line 32

def fn
  @fn
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name


32
33
34
# File 'lib/beefcake.rb', line 32

def name
  @name
end

#optsObject

Returns the value of attribute opts

Returns:

  • (Object)

    the current value of opts


32
33
34
# File 'lib/beefcake.rb', line 32

def opts
  @opts
end

#ruleObject

Returns the value of attribute rule

Returns:

  • (Object)

    the current value of rule


32
33
34
# File 'lib/beefcake.rb', line 32

def rule
  @rule
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type


32
33
34
# File 'lib/beefcake.rb', line 32

def type
  @type
end

Instance Method Details

#<=>(o) ⇒ Object


33
34
35
# File 'lib/beefcake.rb', line 33

def <=>(o)
  fn <=> o.fn
end

#is_protobuf?Boolean

Returns:

  • (Boolean)

45
46
47
# File 'lib/beefcake.rb', line 45

def is_protobuf?
  type.is_a?(Class) and type.include?(Beefcake::Message)
end

#matches_type?(obj) ⇒ Boolean

Returns:

  • (Boolean)

41
42
43
# File 'lib/beefcake.rb', line 41

def matches_type?(obj)
  obj.is_a? type
end

#optional?Boolean

Returns:

  • (Boolean)

51
# File 'lib/beefcake.rb', line 51

def optional? ; rule == :optional end

#repeated?Boolean

Returns:

  • (Boolean)

50
# File 'lib/beefcake.rb', line 50

def repeated? ; rule == :repeated end

#required?Boolean

Returns:

  • (Boolean)

49
# File 'lib/beefcake.rb', line 49

def required? ; rule == :required end

#same_type?(obj) ⇒ Boolean

Returns:

  • (Boolean)

37
38
39
# File 'lib/beefcake.rb', line 37

def same_type?(obj)
  type == obj
end