Class: UIC::Behavior
- Inherits:
-
Object
- Object
- UIC::Behavior
- Includes:
- FileBacked
- Defined in:
- lib/ruic/behaviors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#lua ⇒ Object
readonly
Returns the value of attribute lua.
Attributes included from FileBacked
Instance Method Summary collapse
- #errors ⇒ Object
- #errors? ⇒ Boolean
-
#initialize(lua_path) ⇒ Behavior
constructor
A new instance of Behavior.
- #load_from_file ⇒ Object
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
#lua ⇒ Object (readonly)
Returns the value of attribute lua.
3 4 5 |
# File 'lib/ruic/behaviors.rb', line 3 def lua @lua end |
Instance Method Details
#errors ⇒ Object
16 17 18 |
# File 'lib/ruic/behaviors.rb', line 16 def errors file_found? ? [] : ["File not found: '#{file}'"] end |
#errors? ⇒ Boolean
12 13 14 |
# File 'lib/ruic/behaviors.rb', line 12 def errors? !errors.empty? end |
#load_from_file ⇒ Object
8 9 10 |
# File 'lib/ruic/behaviors.rb', line 8 def load_from_file @lua = File.read(file,encoding:'utf-8') end |