Class: Adjective::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/adjective/table.rb

Direct Known Subclasses

Experience

Defined Under Namespace

Classes: Experience

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/adjective/table.rb', line 6

def data
  @data
end

#nameObject

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

Returns:

  • (Boolean)


20
21
22
# File 'lib/adjective/table.rb', line 20

def set_exists?(name)
  @data.key?(name)
end