Module: Naniyatsu
- Defined in:
- lib/naniyatsu.rb,
lib/naniyatsu/version.rb
Constant Summary collapse
- VERSION =
'0.0.2'
Instance Attribute Summary collapse
-
#root_naniyatsu_class ⇒ Object
readonly
Returns the value of attribute root_naniyatsu_class.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#root_naniyatsu_class ⇒ Object (readonly)
Returns the value of attribute root_naniyatsu_class.
5 6 7 |
# File 'lib/naniyatsu.rb', line 5 def root_naniyatsu_class @root_naniyatsu_class end |
Class Method Details
.extended(klass) ⇒ Object
7 8 9 10 |
# File 'lib/naniyatsu.rb', line 7 def self.extended(klass) klass.instance_variable_set :@root_naniyatsu_class, klass klass.send(:define_method, klass.naniyatsu_method_name(klass), -> { true }) end |
Instance Method Details
#inherited(klass) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/naniyatsu.rb', line 12 def inherited(klass) root_naniyatsu_class = klass.superclass.root_naniyatsu_class klass.instance_variable_set :@root_naniyatsu_class, root_naniyatsu_class klass.send(:define_method, naniyatsu_method_name(klass), -> { true }) root_naniyatsu_class.send(:define_method, naniyatsu_method_name(klass), -> { false }) super end |
#naniyatsu_method_name(klass) ⇒ Object
20 21 22 |
# File 'lib/naniyatsu.rb', line 20 def naniyatsu_method_name(klass) klass.to_s.underscore + '?' end |