Class: UIC::Behavior

Inherits:
Object
  • Object
show all
Includes:
FileBacked
Defined in:
lib/ruic/behaviors.rb

Direct Known Subclasses

Application::Behavior

Instance Attribute Summary collapse

Attributes included from FileBacked

#doc, #file

Instance Method Summary collapse

Methods included from FileBacked

#file_found?, #filename, #path_to, #save!, #save_as, #to_xml

Constructor Details

#initialize(lua_path) ⇒ Behavior

Returns a new instance of Behavior.



4
5
6
7
# File 'lib/ruic/behaviors.rb', line 4

def initialize( lua_path )
	self.file = lua_path
	load_from_file if file_found?
end

Instance Attribute Details

#luaObject (readonly)

Returns the value of attribute lua.



3
4
5
# File 'lib/ruic/behaviors.rb', line 3

def lua
  @lua
end

Instance Method Details

#errorsObject



16
17
18
# File 'lib/ruic/behaviors.rb', line 16

def errors
	file_found? ? [] : ["File not found: '#{file}'"]
end

#errors?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/ruic/behaviors.rb', line 12

def errors?
	!errors.empty?
end

#load_from_fileObject



8
9
10
# File 'lib/ruic/behaviors.rb', line 8

def load_from_file
	@lua = File.read(file,encoding:'utf-8')
end