Class: JSONAPIonify::Types::StringType::StringSampler
- Inherits:
-
Object
- Object
- JSONAPIonify::Types::StringType::StringSampler
- Defined in:
- lib/jsonapionify/types/string_type.rb
Instance Method Summary collapse
- #description ⇒ Object (also: #body, #content, #prompt)
- #domain ⇒ Object
- #full_name ⇒ Object
- #hacker_speak ⇒ Object
-
#initialize(field_name) ⇒ StringSampler
constructor
A new instance of StringSampler.
- #value ⇒ Object
Constructor Details
#initialize(field_name) ⇒ StringSampler
Returns a new instance of StringSampler.
26 27 28 |
# File 'lib/jsonapionify/types/string_type.rb', line 26 def initialize(field_name) @field_name = field_name end |
Instance Method Details
#description ⇒ Object Also known as: body, content, prompt
42 43 44 |
# File 'lib/jsonapionify/types/string_type.rb', line 42 def description Faker::Lorem.paragraph end |
#domain ⇒ Object
38 39 40 |
# File 'lib/jsonapionify/types/string_type.rb', line 38 def domain [Faker::Internet.domain_word, Faker::Internet.domain_suffix].join '.' end |
#full_name ⇒ Object
34 35 36 |
# File 'lib/jsonapionify/types/string_type.rb', line 34 def full_name Faker::Name.name end |
#hacker_speak ⇒ Object
30 31 32 |
# File 'lib/jsonapionify/types/string_type.rb', line 30 def hacker_speak Faker::Hacker.say_something_smart end |
#value ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/jsonapionify/types/string_type.rb', line 50 def value if self.class.instance_methods(false).include?(@field_name) public_send(@field_name) elsif (field = self.class.instance_methods(false).find { |m| @field_name.to_s.include? m.to_s }) public_send(field) else Faker::Lorem.word end end |