Class: Cheri::JRuby::Explorer::TypeViewer
- Inherits:
-
Object
- Object
- Cheri::JRuby::Explorer::TypeViewer
- Defined in:
- lib/cheri/jruby/explorer/viewer.rb
Overview
self
Instance Method Summary collapse
- #[](type) ⇒ Object
- #[]=(type, type_viewer) ⇒ Object
- #clazz ⇒ Object
- #clazz=(c) ⇒ Object
-
#initialize(type, clazz) ⇒ TypeViewer
constructor
A new instance of TypeViewer.
-
#new(*r) ⇒ Object
convenience method for instantiating
clazz. - #subtypes ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(type, clazz) ⇒ TypeViewer
Returns a new instance of TypeViewer.
86 87 88 89 90 91 |
# File 'lib/cheri/jruby/explorer/viewer.rb', line 86 def initialize(type,clazz) raise Cheri.new_type_error(type,Symbol,Class) unless Symbol === type || Class === type raise Cheri.new_type_error(clazz,Class) unless clazz.nil? || Class === clazz @t = type @c = clazz if clazz end |
Instance Method Details
#[](type) ⇒ Object
110 111 112 113 114 |
# File 'lib/cheri/jruby/explorer/viewer.rb', line 110 def [](type) raise Cheri.new_type_error(type,Symbol,Class,String) unless Symbol === type || Class === type || String === type @s ? @s[type] : nil end |
#[]=(type, type_viewer) ⇒ Object
105 106 107 108 109 |
# File 'lib/cheri/jruby/explorer/viewer.rb', line 105 def []=(type,type_viewer) raise Cheri.new_type_error(type,Symbol,Class) unless Symbol === type || Class === type raise Cheri.new_type_error(type_viewer,TypeViewer) unless TypeViewer === type_viewer (@s ||= {})[type] = type_viewer end |
#clazz ⇒ Object
95 96 97 |
# File 'lib/cheri/jruby/explorer/viewer.rb', line 95 def clazz @c end |
#clazz=(c) ⇒ Object
98 99 100 101 |
# File 'lib/cheri/jruby/explorer/viewer.rb', line 98 def clazz=(c) raise Cheri.new_type_error(c,Class) unless Class === c @c = c end |
#new(*r) ⇒ Object
convenience method for instantiating clazz
117 118 119 |
# File 'lib/cheri/jruby/explorer/viewer.rb', line 117 def new(*r) @c.new(*r) if @c end |
#subtypes ⇒ Object
102 103 104 |
# File 'lib/cheri/jruby/explorer/viewer.rb', line 102 def subtypes @s end |
#type ⇒ Object
92 93 94 |
# File 'lib/cheri/jruby/explorer/viewer.rb', line 92 def type @t end |