Class: AzaharaSchema::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/azahara_schema/output.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ Output

Returns a new instance of Output.



14
15
16
# File 'lib/azahara_schema/output.rb', line 14

def initialize(schema)
  @schema = schema
end

Instance Attribute Details

#schemaObject (readonly)

Returns the value of attribute schema.



4
5
6
# File 'lib/azahara_schema/output.rb', line 4

def schema
  @schema
end

Class Method Details

.keyObject



6
7
8
# File 'lib/azahara_schema/output.rb', line 6

def self.key
  self.name.split('::').last.sub(/Output$/, '').underscore
end

Instance Method Details

#formatter(template) ⇒ Object



35
36
37
# File 'lib/azahara_schema/output.rb', line 35

def formatter(template)
  template.attribute_formatter_for(schema)
end

#keyObject



10
11
12
# File 'lib/azahara_schema/output.rb', line 10

def key
  self.class.key
end

#modelObject



18
19
20
# File 'lib/azahara_schema/output.rb', line 18

def model
  @schema.model
end

#model_i18n_keyObject



26
27
28
# File 'lib/azahara_schema/output.rb', line 26

def model_i18n_key
  model_name.i18n_key
end

#model_nameObject



22
23
24
# File 'lib/azahara_schema/output.rb', line 22

def model_name
  model.model_name
end

#to_partial_pathObject

rendering



31
32
33
# File 'lib/azahara_schema/output.rb', line 31

def to_partial_path
  'azahara_schema/outputs/'+key
end