Class: LtdTemplate::Value::Nil

Inherits:
Code
  • Object
show all
Defined in:
lib/ltdtemplate/value/nil.rb

Instance Attribute Summary

Attributes inherited from Code

#tpl_methods

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Code

#do_method, #do_set, #get_item, #has_item?, #initialize, #is_set?, #set_item, #set_value

Constructor Details

This class inherits a constructor from LtdTemplate::Code

Class Method Details

.instance(template, *args) ⇒ Object

Use one shared instance per template.



12
13
14
# File 'lib/ltdtemplate/value/nil.rb', line 12

def self.instance (template, *args)
	template.factory_singletons[:nil] ||= self.new(template, *args)
end

Instance Method Details

#get_value(opts = {}) ⇒ Object



16
17
18
19
20
21
# File 'lib/ltdtemplate/value/nil.rb', line 16

def get_value (opts = {})
	case opts[:method]
	when 'type' then @template.factory :string, 'nil'
	else do_method opts
	end
end

#to_booleanObject



23
# File 'lib/ltdtemplate/value/nil.rb', line 23

def to_boolean; false; end

#to_nativeObject



24
# File 'lib/ltdtemplate/value/nil.rb', line 24

def to_native; ''; end

#to_textObject



25
# File 'lib/ltdtemplate/value/nil.rb', line 25

def to_text; ''; end