class Blockhead::Marshaller
Attributes
arg[R]
attributes[R]
object[R]
Public Class Methods
new(object)
click to toggle source
# File lib/blockhead/marshaller.rb, line 5 def initialize(object) @attributes = {} @object = object end
Public Instance Methods
marshal()
click to toggle source
# File lib/blockhead/marshaller.rb, line 10 def marshal attributes end
method_missing(name, *args, &block)
click to toggle source
# File lib/blockhead/marshaller.rb, line 14 def method_missing(name, *args, &block) @arg = args.first key = AliasKey.new(name, arg).key attributes[key] = ValueExtractor.new(_call(name), arg, &block).extract end
Private Instance Methods
_call(name)
click to toggle source
# File lib/blockhead/marshaller.rb, line 24 def _call(name) if @arg == :wrap object elsif valid_message?(name) object.send name end end
valid_message?(name)
click to toggle source
# File lib/blockhead/marshaller.rb, line 32 def valid_message?(name) object.respond_to?(name) && !object.nil? # nil responds to :id in Rails. end