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.



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

def initialize fun
  @fun = fun
end

Instance Method Details

#call(*args) ⇒ Object



81
82
83
# File 'lib/serializer.rb', line 81

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

#callback(*args) ⇒ Object



77
78
79
# File 'lib/serializer.rb', line 77

def callback *args
  @fun.call *args
end

#method(atom) ⇒ Object



85
86
87
88
89
90
91
# File 'lib/serializer.rb', line 85

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

#methods(bool) ⇒ Object



93
94
95
# File 'lib/serializer.rb', line 93

def methods bool
  [:callback]
end

#respond_to?(atom) ⇒ Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/serializer.rb', line 97

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