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.
-
#instance ⇒ Object
Returns the value of attribute instance.
-
#namespace ⇒ Object
-
args - none - return - String.
-
-
#procedure ⇒ Object
Returns the value of attribute procedure.
Class Method Summary collapse
-
.auto_namespace ⇒ Object
-
args - none - return - Boolean.
-
-
.auto_namespace=(val) ⇒ Object
-
args 1.
-
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#[](key) ⇒ Object
-
args 1.
-
-
#initialize(options, &procedure) ⇒ ComponentInfoDef
constructor
-
args 1.
-
-
#match(matcher) ⇒ Object
-
args 1.
-
Constructor Details
#initialize(options, &procedure) ⇒ ComponentInfoDef
-
args
-
Hash options
-
Proc procedure
-
45 46 47 48 49 50 51 52 |
# File 'lib/seasar/container/component-info-def.rb', line 45 def initialize(, &procedure) @component_class = [:class] @component_name = [:name] @instance = [:instance] @autobinding = [:autobinding] @namespace = [:namespace] @procedure = procedure 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 |
#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
-
61 62 63 |
# File 'lib/seasar/container/component-info-def.rb', line 61 def namespace @namespace end |
#procedure ⇒ Object
Returns the value of attribute procedure.
53 54 55 |
# File 'lib/seasar/container/component-info-def.rb', line 53 def procedure @procedure 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
#==(other) ⇒ Object
107 108 109 110 111 112 113 114 |
# File 'lib/seasar/container/component-info-def.rb', line 107 def ==(other) @component_class == other.component_class && @component_name == other.component_name && @instance == other.instance && @autobinding == other.autobinding && self.namespace() == other.namespace() && @procedure == other.procedure end |
#[](key) ⇒ Object
-
args
-
Symbol key
-
-
return
-
Object
-
75 76 77 |
# File 'lib/seasar/container/component-info-def.rb', line 75 def [](key) return self.instance_variable_get(key) end |
#match(matcher) ⇒ Object
-
args
-
Objectn matcher
-
-
return
-
Boolean
-
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/seasar/container/component-info-def.rb', line 85 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 |