Module: ROC::Types::MethodGenerators

Included in:
Hash, List, Set, SortedSet, String, AllTypes, ScalarType
Defined in:
lib/roc/types/method_generators.rb

Instance Method Summary collapse

Instance Method Details

#deserializing_method(method_name) ⇒ Object



11
12
13
14
15
# File 'lib/roc/types/method_generators.rb', line 11

def deserializing_method(method_name)
  self.send :define_method, method_name do
    self.deserialize(self.call method_name)
  end
end

#nonserializing_method(method_name) ⇒ Object



29
30
31
32
33
# File 'lib/roc/types/method_generators.rb', line 29

def nonserializing_method(method_name)
  self.send :define_method, method_name do |val|
    self.call method_name, val
  end
end

#serializing_and_deserializing_method(method_name) ⇒ Object



17
18
19
20
21
# File 'lib/roc/types/method_generators.rb', line 17

def serializing_and_deserializing_method(method_name)
  self.send :define_method, method_name do |val|
    self.deserialize(self.call method_name, self.serialize(val))
  end
end

#serializing_method(method_name) ⇒ Object



5
6
7
8
9
# File 'lib/roc/types/method_generators.rb', line 5

def serializing_method(method_name)
  self.send :define_method, method_name do |val|
    self.call method_name, self.serialize(val)        
  end
end

#zero_arg_method(method_name) ⇒ Object



23
24
25
26
27
# File 'lib/roc/types/method_generators.rb', line 23

def zero_arg_method(method_name)
  self.send :define_method, method_name do
    self.call method_name
  end
end