Class: Adjective::Table
- Inherits:
-
Object
- Object
- Adjective::Table
- Defined in:
- lib/adjective/table.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Experience
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(dir, name = nil) ⇒ Table
constructor
A new instance of Table.
- #load(dir) ⇒ Object
- #set_exists?(name) ⇒ Boolean
Constructor Details
#initialize(dir, name = nil) ⇒ Table
Returns a new instance of Table.
8 9 10 11 12 13 |
# File 'lib/adjective/table.rb', line 8 def initialize(dir, name = nil) file_existence_catch(dir) @name = name @data = YAML.load_file(dir) @_created_at = Time.now end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/adjective/table.rb', line 6 def data @data end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/adjective/table.rb', line 5 def name @name end |
Instance Method Details
#load(dir) ⇒ Object
15 16 17 18 |
# File 'lib/adjective/table.rb', line 15 def load(dir) file_existence_catch(dir) @data = YAML.load_file(dir) end |
#set_exists?(name) ⇒ Boolean
20 21 22 |
# File 'lib/adjective/table.rb', line 20 def set_exists?(name) @data.key?(name) end |