Add public methods for injections

This commit is contained in:
Roman Mogilatov 2016-11-02 11:24:46 +02:00
parent e5498f214b
commit 214a64732b
2 changed files with 15 additions and 3 deletions

View File

@ -17,7 +17,7 @@ cdef class PositionalInjection(Injection):
cdef int __is_delegated cdef int __is_delegated
cdef int __call cdef int __call
cdef inline object get_value(self): cdef inline object __get_value(self):
if self.__call == 0: if self.__call == 0:
return self.__value return self.__value
return self.__value() return self.__value()
@ -30,10 +30,10 @@ cdef class NamedInjection(Injection):
cdef int __is_delegated cdef int __is_delegated
cdef int __call cdef int __call
cdef inline object get_name(self): cdef inline object __get_name(self):
return self.__name return self.__name
cdef inline object get_value(self): cdef inline object __get_value(self):
if self.__call == 0: if self.__call == 0:
return self.__value return self.__value
return self.__value() return self.__value()

View File

@ -21,6 +21,10 @@ cdef class PositionalInjection(Injection):
self.__is_delegated = 0 self.__is_delegated = 0
self.__call = <int>self.__is_provider == 1 and self.__is_delegated == 0 self.__call = <int>self.__is_provider == 1 and self.__is_delegated == 0
def get_value(self):
"""Return injection value."""
return self.__get_value()
cdef class NamedInjection(Injection): cdef class NamedInjection(Injection):
"""Keyword injection class.""" """Keyword injection class."""
@ -33,6 +37,14 @@ cdef class NamedInjection(Injection):
self.__is_delegated = 0 self.__is_delegated = 0
self.__call = <int>self.__is_provider == 1 and self.__is_delegated == 0 self.__call = <int>self.__is_provider == 1 and self.__is_delegated == 0
def get_name(self):
"""Return injection value."""
return self.__get_name()
def get_value(self):
"""Return injection value."""
return self.__get_value()
cpdef tuple parse_positional_injections(tuple args): cpdef tuple parse_positional_injections(tuple args):
"""Parse positional injections.""" """Parse positional injections."""