Class: Seasar::Container::ComponentInfoDef
- Inherits:
-
Object
- Object
- Seasar::Container::ComponentInfoDef
- Defined in:
- lib/seasar/container/component-info-def.rb
Constant Summary collapse
- @@auto_namespace =
false
Instance Attribute Summary collapse
-
#autobinding ⇒ Object
Returns the value of attribute autobinding.
-
#component_class ⇒ Object
Returns the value of attribute component_class.
-
#component_name ⇒ Object
Returns the value of attribute component_name.
-
#constructor(&block) ⇒ Object
-
args 1.
-
-
#destructor(&block) ⇒ Object
-
args 1.
-
-
#instance ⇒ Object
Returns the value of attribute instance.
-
#namespace ⇒ Object
-
args - none - return - String.
-
Class Method Summary collapse
-
.auto_namespace ⇒ Object
-
args - none - return - Boolean.
-
-
.auto_namespace=(val) ⇒ Object
-
args 1.
-
Instance Method Summary collapse
-
#[](key) ⇒ Object
-
args 1.
-
-
#initialize(options, &block) ⇒ ComponentInfoDef
constructor
-
args 1.
-
-
#match(matcher) ⇒ Object
-
args 1.
-
Constructor Details
#initialize(options, &block) ⇒ ComponentInfoDef
-
args
-
Hash options
-
Proc block
-
45 46 47 48 49 50 51 52 |
# File 'lib/seasar/container/component-info-def.rb', line 45 def initialize(, &block) @component_class = [:class] @component_name = [:name] @instance = [:instance] @autobinding = [:autobinding] @namespace = [:namespace] @constructor = block end |
Instance Attribute Details
#autobinding ⇒ Object
Returns the value of attribute autobinding.
53 54 55 |
# File 'lib/seasar/container/component-info-def.rb', line 53 def autobinding @autobinding end |
#component_class ⇒ Object
Returns the value of attribute component_class.
53 54 55 |
# File 'lib/seasar/container/component-info-def.rb', line 53 def component_class @component_class end |
#component_name ⇒ Object
Returns the value of attribute component_name.
53 54 55 |
# File 'lib/seasar/container/component-info-def.rb', line 53 def component_name @component_name end |
#constructor(&block) ⇒ Object
-
args
-
Proc|nil block
-
-
return
-
Proc
-
62 63 64 |
# File 'lib/seasar/container/component-info-def.rb', line 62 def constructor @constructor end |
#destructor(&block) ⇒ Object
-
args
-
Proc|nil block
-
-
return
-
Proc
-
75 76 77 |
# File 'lib/seasar/container/component-info-def.rb', line 75 def destructor @destructor end |
#instance ⇒ Object
Returns the value of attribute instance.
53 54 55 |
# File 'lib/seasar/container/component-info-def.rb', line 53 def instance @instance end |
#namespace ⇒ Object
-
args
-
none
-
-
return
-
String
-
88 89 90 |
# File 'lib/seasar/container/component-info-def.rb', line 88 def namespace @namespace end |
Class Method Details
.auto_namespace ⇒ Object
-
args
-
none
-
-
return
-
Boolean
-
39 |
# File 'lib/seasar/container/component-info-def.rb', line 39 def auto_namespace; return @@auto_namespace; end |
.auto_namespace=(val) ⇒ Object
-
args
-
Boolean val
-
-
return
-
none
-
31 |
# File 'lib/seasar/container/component-info-def.rb', line 31 def auto_namespace=(val); @@auto_namespace = val; end |
Instance Method Details
#[](key) ⇒ Object
-
args
-
Symbol key
-
-
return
-
Object
-
102 103 104 |
# File 'lib/seasar/container/component-info-def.rb', line 102 def [](key) return self.instance_variable_get(key) end |
#match(matcher) ⇒ Object
-
args
-
Objectn matcher
-
-
return
-
Boolean
-
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/seasar/container/component-info-def.rb', line 112 def match(matcher) case when matcher.is_a?(Regexp) if @component_name.is_a?(String) if matcher.match(@component_name) return true end end return matcher.match(@component_class.name) when matcher.is_a?(Class) return @component_class == matcher when matcher.is_a?(Module) return @component_class.name.match(/^#{matcher.name}::/) when matcher.is_a?(String) return (matcher == @component_name or matcher == @component_class.name) when matcher.is_a?(Symbol) return (matcher == @component_name or matcher == @component_class.name.to_sym) else raise ArgumentError.new("unsupported argument #{matcher}") end end |