Class: Sinclair::MethodDefinition
- Inherits:
-
Object
- Object
- Sinclair::MethodDefinition
- Defined in:
- lib/sinclair/method_definition.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #build(clazz) ⇒ Object
-
#initialize(name, code = nil, &block) ⇒ MethodDefinition
constructor
A new instance of MethodDefinition.
Constructor Details
#initialize(name, code = nil, &block) ⇒ MethodDefinition
Returns a new instance of MethodDefinition.
4 5 6 7 8 |
# File 'lib/sinclair/method_definition.rb', line 4 def initialize(name, code = nil, &block) @name = name @code = code @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
2 3 4 |
# File 'lib/sinclair/method_definition.rb', line 2 def block @block end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
2 3 4 |
# File 'lib/sinclair/method_definition.rb', line 2 def code @code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/sinclair/method_definition.rb', line 2 def name @name end |
Instance Method Details
#build(clazz) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/sinclair/method_definition.rb', line 10 def build(clazz) if code.is_a?(String) build_code_method(clazz) else build_block_method(clazz) end end |