Skip to content

Commit

Permalink
Merge pull request mozy#18 from mculp/master
Browse files Browse the repository at this point in the history
add an attr_reader for proxy_class in message fields
  • Loading branch information
codekitchen committed Jan 21, 2012
2 parents 2b1ccc4 + ef532db commit 57df9f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/protocol_buffers/runtime/field.rb
Expand Up @@ -533,6 +533,8 @@ def inspect_value(value)

class MessageField < Field
include WireFormats::LENGTH_DELIMITED

attr_reader :proxy_class

def initialize(proxy_class, otype, name, tag, opts = {})
super(otype, name, tag, opts)
Expand Down
4 changes: 4 additions & 0 deletions spec/fields_spec.rb
Expand Up @@ -46,4 +46,8 @@ def mkfield(ftype)
end
end

it "provides a reader for proxy_class on message fields" do
ProtocolBuffers::Field::MessageField.new(nil, :optional, :fake_name, 1).should respond_to(:proxy_class)
ProtocolBuffers::Field::MessageField.new(Class, :optional, :fake_name, 1).proxy_class.should == Class
end
end

0 comments on commit 57df9f9

Please sign in to comment.