Class: TextRecord::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/text_record/attribute.rb

Direct Known Subclasses

FileAttribute, YAMLAttribute

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ Attribute

Returns a new instance of Attribute.



9
10
11
12
# File 'lib/text_record/attribute.rb', line 9

def initialize(name, options) 
  @name = name
  @options = options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/text_record/attribute.rb', line 3

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/text_record/attribute.rb', line 3

def options
  @options
end

Class Method Details

.for_options(options) ⇒ Object



5
6
7
# File 'lib/text_record/attribute.rb', line 5

def self.for_options(options) 
  (options[:from].eql?(:yml)) ? YAMLAttribute : FileAttribute      
end