Class: Omelettes::Column
- Inherits:
-
Object
- Object
- Omelettes::Column
- Defined in:
- lib/omelettes/column.rb
Instance Attribute Summary collapse
-
#custom_block ⇒ Object
Returns the value of attribute custom_block.
-
#name ⇒ Object
Returns the value of attribute name.
-
#style ⇒ Object
Returns the value of attribute style.
Class Method Summary collapse
Instance Method Summary collapse
- #as(style) ⇒ Object (also: #like)
-
#initialize(name, style = nil, &block) ⇒ Column
constructor
A new instance of Column.
- #process(string) ⇒ Object
Constructor Details
#initialize(name, style = nil, &block) ⇒ Column
Returns a new instance of Column.
6 7 8 9 10 |
# File 'lib/omelettes/column.rb', line 6 def initialize(name, style=nil, &block) @name = name @style = style @custom_block = block end |
Instance Attribute Details
#custom_block ⇒ Object
Returns the value of attribute custom_block.
5 6 7 |
# File 'lib/omelettes/column.rb', line 5 def custom_block @custom_block end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/omelettes/column.rb', line 5 def name @name end |
#style ⇒ Object
Returns the value of attribute style.
5 6 7 |
# File 'lib/omelettes/column.rb', line 5 def style @style end |
Class Method Details
.default(name, value) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/omelettes/column.rb', line 20 def self.default(name, value) name = name.to_s.downcase.to_sym case name when :hardened return value when :first_name, :last_name return Faker::Name.send(name) when :city, :state, :country, :street_address, :street_name, :zip_code return Faker::Address.send(name) when :company_name, :company return Faker::Company.name when :email, :user_name return Faker::Internet.send(name) when :paragraph, :paragraphs, :sentence, :sentences, :words return Faker::Lorem.send(name) when :phone, :contact_phone, :fax return Faker::PhoneNumber.phone_number when :url, :website return Faker::Internet.domain_name else return Omelettes::Obfuscate.obfuscate(value) end end |
Instance Method Details
#as(style) ⇒ Object Also known as: like
44 45 46 47 |
# File 'lib/omelettes/column.rb', line 44 def as(style) @style = style unless @style == :hardened self end |