Top Level Namespace
Defined Under Namespace
Modules: RybishCode
Classes: AbstractStudent, DataList, DataListStudentShort, DataTable, DataTransformer, DataTransformerJson, DataTransformerYaml, LoggerHolder, Student, StudentBase, StudentInputFormControllerCreate, StudentInputFormControllerEdit, StudentShort, StudentsList, TabStudentsController
Instance Method Summary
collapse
Instance Method Details
#attr_is_have_reader(methods) ⇒ Object
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/source/support/meta_code.rb', line 53
def attr_is_have_reader(methods)
class_eval %{
def #{methods}
@#{methods}
end
def #{methods}?
!@#{methods}.nil?
end
}
end
|
#attr_validate_accessor(methods, regex) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/source/support/meta_code.rb', line 41
def attr_validate_accessor(methods, regex)
class_eval %{
def #{methods}=(new_value)
if new_value == nil || new_value !~ #{regex}
raise ArgumentError
end
@#{methods} = new_value
end
attr_validate_reader :#{methods}, '#{regex}'
}
end
|
#attr_validate_reader(methods, regex) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/source/support/meta_code.rb', line 27
def attr_validate_reader(methods, regex)
class_eval %{
def #{methods}
@#{methods}
end
def self.validate_#{methods}?(value)
value.match(#{regex})
end
def #{methods}?
!@#{methods}.nil?
end
}
end
|
#getter(*methods) ⇒ Object
1
2
3
4
5
6
7
8
9
|
# File 'lib/source/support/meta_code.rb', line 1
def getter(*methods)
methods.each do |method|
class_eval %{
def get_#{method}
"#{method}:#\{#{method}\}"
end
}
end
end
|
#private_attr_accessor(*methods) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/source/support/meta_code.rb', line 19
def private_attr_accessor(*methods)
methods.each do |method|
class_eval %{
attr_accessor :#{method};private :#{method}=
}
end
end
|
#private_attr_writer(*methods) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/source/support/meta_code.rb', line 11
def private_attr_writer(*methods)
methods.each do |method|
class_eval %{
attr_writer :#{method};private :#{method}=
}
end
end
|