Class: Bridge::Serializer::Callback

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

Instance Method Summary collapse

Constructor Details

#initialize(fun) ⇒ Callback

Returns a new instance of Callback.



66
67
68
# File 'lib/serializer.rb', line 66

def initialize fun
  @fun = fun
end

Instance Method Details

#call(*args) ⇒ Object



74
75
76
# File 'lib/serializer.rb', line 74

def call *args
  @fun.call(*args)
end

#callback(*args) ⇒ Object



70
71
72
# File 'lib/serializer.rb', line 70

def callback *args
  @fun.call *args
end

#method(atom) ⇒ Object



78
79
80
81
82
83
84
# File 'lib/serializer.rb', line 78

def method atom
  if atom.to_s == 'callback'
    @fun
  else
    Class.method atom
  end
end

#methods(bool) ⇒ Object



86
87
88
# File 'lib/serializer.rb', line 86

def methods bool
  [:callback]
end

#respond_to?(atom) ⇒ Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/serializer.rb', line 90

def respond_to? atom
  atom.to_s == 'callback' || Class.respond_to?(atom)
end